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