public void GetById_ShouldReturnNull_WhenWrongId() { // Arrange var context = GetContext(TestData.operatingAreas); var repo = new SqlOperatingAreaRepo(context); // Act var operatingArea = repo.GetById(999); // Assert Assert.Null(operatingArea); context.Database.EnsureDeleted(); context.Dispose(); }
public void GetAll_ShouldReturnOperatingAreas() { // Arrange var context = GetContext(TestData.operatingAreas); var repo = new SqlOperatingAreaRepo(context); // Act var operatingAreas = repo.GetAll(); // Assert Assert.Equal(TestData.operatingAreas, operatingAreas); context.Database.EnsureDeleted(); context.Dispose(); }
public void GetById_ShouldReturnOperatingArea() { // Arrange var context = GetContext(TestData.operatingAreas); var repo = new SqlOperatingAreaRepo(context); int id = _rnd.Next(1, TestData.operatingAreas.Count()); // Act var operatingArea = repo.GetById(id); // Assert Assert.Equal(TestData.operatingAreas.SingleOrDefault(v => v.Id == id), operatingArea); context.Database.EnsureDeleted(); context.Dispose(); }