public void UserStoreInterface_CreateAsync_ThrowsArgumentNullException_WhenUserIsNull() { var instance = new SecurityStore(null) as IUserStore <User, int>; var exception = Assert.Throws <ArgumentNullException>(() => instance.CreateAsync(null).GetAwaiter().GetResult()); exception.ShouldNotBeNull(); exception.ParamName.ShouldEqual("user"); }
public void UserStoreInterface_CreateAsync_CreatesUserEntity() { var entities = new Mock <IWriteEntities>(MockBehavior.Strict); var instance = new SecurityStore(entities.Object) as IUserStore <User, int>; var entity = new User(); entities.Setup(x => x.Create(entity)); instance.CreateAsync(entity); entities.Verify(x => x.Create(entity), Times.Once); }
public void UserStoreInterface_CreateAsync_ThrowsWhenDisposed() { var instance = new SecurityStore(null) as IUserStore <User, int>; instance.Dispose(); var exception = Assert.Throws <ObjectDisposedException>(() => instance.CreateAsync(new FakeUser(6)).GetAwaiter().GetResult()); exception.ShouldNotBeNull(); exception.ObjectName.ShouldEqual(instance.GetType().Name); }