public void FakeDataContextTests_IUserStore_Implemented() { var context = new FakeDataContext(); Assert.ThrowsAny <NotImplementedException>(() => context.GetUserIdAsync(null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.GetUserNameAsync(null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.SetUserNameAsync(null, null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.GetNormalizedUserNameAsync(null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.SetNormalizedUserNameAsync(null, null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.CreateAsync(null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.UpdateAsync(null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.DeleteAsync(null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.FindByIdAsync(null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.FindByNameAsync(null, new CancellationToken())); Assert.ThrowsAny <NotImplementedException>(() => context.Dispose()); var task = context.SaveChangesAsync(); task.Wait(); Assert.Equal(task.Result, 0); }
public void Dispose_MultipleDataSets_ShouldDisposeAllInternalContexts( Mock<BaseDataSet<int>> dataSet1, Mock<BaseDataSet<string>> dataSet2, FakeDataContext context) { // Arrange context.SetUpDataSet(dataSet1.Object); context.Set<int>(); context.SetUpDataSet(dataSet2.Object); context.Set<string>(); // Act context.Dispose(); // Assert dataSet1.Verify(s => s.Dispose(), Times.Once); dataSet2.Verify(s => s.Dispose(), Times.Once); }