public async Task Contains_AddedCell() { await Sut.AddAsync(CellEntity1); var cellEntities = await Sut.LoadAsync(); cellEntities.Should().Contain(CellEntity1); }
public async Task AddAsync_ShouldThrowWhen_InsertDuplicateRecordToDatabase() { var newEntity = EntityFactory.Create(); Database.AddData(newEntity); await Assert.ThrowsAsync <ArgumentException>(() => Sut.AddAsync(newEntity)); }
public async Task AddAsync_ShouldLogInformationWhen_Succeeds() { var newEntity = EntityFactory.Create(); await Sut.AddAsync(newEntity); string pattern = $"Added new {typeof(TEntity).Name} with id: {newEntity.Id}"; MockLogger.VerifyLog(LogLevel.Information, pattern, Times.Once()); }
public async Task AddAsync_Should_InsertNewRecordToDatabase() { var newEntity = EntityFactory.Create(); await Sut.AddAsync(newEntity); var state = Database.Get(); Assert.Contains(newEntity, state); }
public async Task AddAsync_ShouldLogErrorWhen_Throws() { var newEntity = EntityFactory.Create(); Database.AddData(newEntity); try { await Sut.AddAsync(newEntity); } catch { string pattern = $"Failed to add new {typeof(TEntity).Name} with id: {newEntity.Id}"; MockLogger.VerifyLog(LogLevel.Error, pattern, Times.Once()); } }