public void Given_TestType_When_NewTestTypeIsAdded_Then_ShouldHaveOneTestTypeInDatabase() { RunOnDatabase(context => { // ARRANGE var testTypeRepository = new TestTypesRepository(context); var testType = TestType.Create("grila"); var testTypeInserted = testTypeRepository.InsertAsync(testType).Result; // ACT var result = testTypeRepository.GetByIdAsync(testTypeInserted.Id); // ASSERT result.Should().NotBe(null); }); }
public void Given_TestType_When_DeleteTestTypeAsync_Then_ShouldBeTrue() { RunOnDatabase(context => { // ARRANGE var testTypeRepository = new TestTypesRepository(context); var testType = TestType.Create("grila"); context.TestTypes.Add(testType); context.SaveChanges(); // ACT var result = testTypeRepository.DeleteAsync(testType.Id); // ASSERT result.Result.Should().Be(true); }); }
public void Given_TestTypes_When_GetTestTypesAsyncsIsCalled_Then_ShouldReturnZeroTestTypes() { RunOnDatabase(context => { // ARRANGE var testTypesRepository = new TestTypesRepository(context); // ACT var testTypes = testTypesRepository.GetAllAsync(); var counter = testTypes.Result.Count; // ASSERT counter.Should().Be(0); }); }