Table of Contents

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

Task

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

Task

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

Task

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

Task

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

Task

Exceptions

ArgumentNullException

Thrown when the units collection used to seed the repository is null.

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

Task

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

Task

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()

Returns

Task