public void GetById_ShouldReturnNull_WhenWrongId() { // Arrange var context = GetContext(TestData.generalDataSections); var repo = new SqlGeneralDataSectionRepo(context); // Act var generalDataSection = repo.GetById(999); // Assert Assert.Null(generalDataSection); context.Database.EnsureDeleted(); context.Dispose(); }
public void GetById_ShouldReturnGeneralDataSection() { // Arrange var context = GetContext(TestData.generalDataSections); var repo = new SqlGeneralDataSectionRepo(context); int id = _rnd.Next(1, TestData.generalDataSections.Count()); // Act var generalDataSection = repo.GetById(id); // Assert Assert.Equal(TestData.generalDataSections.SingleOrDefault(v => v.Id == id), generalDataSection); context.Database.EnsureDeleted(); context.Dispose(); }