public void TestRemove() { //Setup var subscriptions = new List <Subscription>() { }; var data = subscriptions.AsQueryable(); var mockSet = setUpAsQueriable(data); mockSet.Setup(d => d.Add(It.IsAny <Subscription>())).Callback <Subscription>((r) => subscriptions.Add(r)); mockSet.Setup(d => d.Remove(It.IsAny <Subscription>())).Callback <Subscription>((r) => subscriptions.Remove(r)); var mockContext = new Mock <TweetContext>(); mockContext.Setup(c => c.Subscriptions).Returns(mockSet.Object); // Arrange SubscriptionDBRepository repo = new SubscriptionDBRepository(mockContext.Object); Subscription newSubscription = new Subscription() { Id = 3, Value = "Track", Type = "Track" }; repo.Add(newSubscription); // Act repo.Remove(3); // Assert Assert.Equal(0, subscriptions.Count); }
public void RemoveTrack(int id) { _subRepo.Remove(id); }