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