Esempio n. 1
0
        public void UserStoreInterface_DeleteAsync_ThrowsArgumentNullException_WhenUserIsNull()
        {
            var instance  = new SecurityStore(null) as IUserStore <User, int>;
            var exception = Assert.Throws <ArgumentNullException>(() =>
                                                                  instance.DeleteAsync(null).GetAwaiter().GetResult());

            exception.ShouldNotBeNull();
            exception.ParamName.ShouldEqual("user");
        }
Esempio n. 2
0
        public void UserStoreInterface_DeleteAsync_DeletesUserEntity()
        {
            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.Delete(entity));
            instance.DeleteAsync(entity);
            entities.Verify(x => x.Delete(entity), Times.Once);
        }
Esempio n. 3
0
        public void UserStoreInterface_DeleteAsync_ThrowsWhenDisposed()
        {
            var instance = new SecurityStore(null) as IUserStore <User, int>;

            instance.Dispose();
            var exception = Assert.Throws <ObjectDisposedException>(() =>
                                                                    instance.DeleteAsync(new FakeUser(6)).GetAwaiter().GetResult());

            exception.ShouldNotBeNull();
            exception.ObjectName.ShouldEqual(instance.GetType().Name);
        }