rama creada apartir de master en j

This commit is contained in:
jrojas
2026-06-26 10:29:23 +02:00
parent 319fd3dfb0
commit c1517fda87
2810 changed files with 1927392 additions and 25392 deletions
@@ -11,24 +11,27 @@ namespace adas_core.Test.Repositories;
[Category("Integration")]
public class ServiceConfigRepositoryTest
{
/// <summary>
/// Performs one-time initialization for integration tests by creating a <see cref="ServiceConfig"/> entry in the test database and preparing the repository used by the test fixture.
/// </summary>
[OneTimeSetUp]
public async Task Init()
{
_optionsApiSettings = Options.Create(_apiSettings);
var serviceConfig = new ServiceConfig
public async Task Init()
{
Id = _id,
StrId = Id.ToString()
};
await IntegrationDb.Database.DropCollectionAsync("service_config");
await IntegrationDb.Database.CreateCollectionAsync("service_config");
_repository = new ServiceConfigRepository(_optionsApiSettings, IntegrationDb.Database);
await _repository.InsertOneAsync(serviceConfig);
}
_optionsApiSettings = Options.Create(_apiSettings);
var serviceConfig = new ServiceConfig
{
Id = _id,
StrId = Id.ToString()
};
await IntegrationDb.Database.DropCollectionAsync("service_config");
await IntegrationDb.Database.CreateCollectionAsync("service_config");
_repository = new ServiceConfigRepository(_optionsApiSettings, IntegrationDb.Database);
await _repository.InsertOneAsync(serviceConfig);
}
private ServiceConfigRepository _repository;
@@ -43,21 +46,29 @@ public class ServiceConfigRepositoryTest
private static readonly ObjectId Id = ObjectId.GenerateNewId();
/// <summary>
/// Verifies that <see cref="_repository"/>.FindById returns a non-null entity when queried by its string identifier,
/// and that the returned entity's <c>StrId</c> matches the supplied id.
/// </summary>
[Test]
public async Task FindById_Find_string()
{
var result = await _repository.FindById(Id.ToString());
Assert.That(result, Is.Not.Null);
Assert.That(result!.StrId, Is.EqualTo(Id.ToString()));
}
public async Task FindById_Find_string()
{
var result = await _repository.FindById(Id.ToString());
Assert.That(result, Is.Not.Null);
Assert.That(result!.StrId, Is.EqualTo(Id.ToString()));
}
/// <summary>
/// Verifies that the repository's FindById method successfully retrieves an object by its identifier,
/// returning a non-null result whose Id matches the requested identifier.
/// </summary>
[Test]
public async Task FindById_Find_ObjectId()
{
var result = await _repository.FindById(_id);
Assert.That(result, Is.Not.Null);
Assert.That(result!.Id, Is.EqualTo(_id));
}
public async Task FindById_Find_ObjectId()
{
var result = await _repository.FindById(_id);
Assert.That(result, Is.Not.Null);
Assert.That(result!.Id, Is.EqualTo(_id));
}
}