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