Class UnitRepositoryTest
- Namespace
- adas_core.Test.Repositories
- Assembly
- adas-core.Test.dll
[TestFixture]
[Category("Integration")]
public class UnitRepositoryTest
- Inheritance
-
UnitRepositoryTest
- Inherited Members
- Extension Methods
Methods
FindById_InvalidId_ReturnsNull()
Verifies that FindById returns null when queried with an ID that does not exist in the repository.
[Test]
public Task FindById_InvalidId_ReturnsNull()
Returns
FindById_ValidId_ReturnsUnit()
Verifies that FindById retrieves the matching Unit from the repository when a valid identifier is provided.
[Test]
public Task FindById_ValidId_ReturnsUnit()
Returns
FindByName_InvalidName_ReturnsNull()
Verifies that the repository's FindByName method returns null when invoked with a name that does not match any existing entity.
[Test]
public Task FindByName_InvalidName_ReturnsNull()
Returns
FindByName_ValidName_ReturnsUnit()
Verifies that the repository's FindByName method returns the matching unit when called with a valid unit name.
The test inserts a unit, retrieves it by name, and asserts that the returned entity is not null and has the expected name.
[Test]
public Task FindByName_ValidName_ReturnsUnit()
Returns
GetAll_ReturnsAllUnits()
Verifies that GetAll returns a non-null collection containing the units that have been inserted into the repository.
[Test]
public Task GetAll_ReturnsAllUnits()
Returns
Exceptions
- ArgumentNullException
Thrown when the
unitscollection used to seed the repository isnull.
Init()
One-time setup method that prepares the integration test environment by configuring API settings, creating a fresh "units" collection in the database, and seeding it with two sample Unit records via the UnitRepository.
[OneTimeSetUp]
public Task Init()
Returns
InsertOneUnit_ValidUnit_ReturnsUnit()
Verifies that inserting a valid Unit into the repository returns the unit and that the inserted unit can be successfully retrieved by its identifier, with key properties preserved.
[Test]
public Task InsertOneUnit_ValidUnit_ReturnsUnit()
Returns
UpdateUnit_ValidUnit_ReturnsUpdatedUnit()
Verifies that UpdateUnit correctly updates an existing unit in the repository and returns the updated entity with the new title and the original identifier.
[Test]
public Task UpdateUnit_ValidUnit_ReturnsUpdatedUnit()