Ejemplo n.º 1
0
        public void QueryableUserStoreInterface_UsersPropertyGetter_ThrowsWhenDisposed()
        {
            var instance = new SecurityStore(null) as IQueryableUserStore <User, int>;

            instance.Dispose();
            var exception = Assert.Throws <ObjectDisposedException>(() => instance.Users);

            exception.ShouldNotBeNull();
            exception.ObjectName.ShouldEqual(instance.GetType().Name);
        }
Ejemplo n.º 2
0
        public void UserClaimStoreInterface_RemoveClaimAsync_ThrowsWhenDisposed()
        {
            var instance = new SecurityStore(null) as IUserClaimStore <User, int>;

            instance.Dispose();
            var exception = Assert.Throws <ObjectDisposedException>(() =>
                                                                    instance.RemoveClaimAsync(null, null).GetAwaiter().GetResult());

            exception.ShouldNotBeNull();
            exception.ObjectName.ShouldEqual(instance.GetType().Name);
        }
Ejemplo n.º 3
0
        public void UserPasswordStoreInterface_GetPasswordHashAsync_ThrowsWhenDisposed()
        {
            var instance = new SecurityStore(null) as IUserPasswordStore <User, int>;

            instance.Dispose();
            var exception = Assert.Throws <ObjectDisposedException>(() =>
                                                                    instance.GetPasswordHashAsync(null).Result);

            exception.ShouldNotBeNull();
            exception.ObjectName.ShouldEqual(instance.GetType().Name);
        }
Ejemplo n.º 4
0
        public void UserStoreInterface_FindByNameAsync_ThrowsWhenDisposed()
        {
            var instance = new SecurityStore(null) as IUserStore <User, int>;

            instance.Dispose();
            var exception = Assert.Throws <ObjectDisposedException>(() =>
                                                                    instance.FindByNameAsync(Guid.NewGuid().ToString()).Result);

            exception.ShouldNotBeNull();
            exception.ObjectName.ShouldEqual(instance.GetType().Name);
        }
Ejemplo n.º 5
0
        public void UserLoginStoreInterface_AddLoginAsync_ThrowsWhenDisposed()
        {
            var instance = new SecurityStore(null) as IUserLoginStore <User, int>;

            instance.Dispose();
            var exception = Assert.Throws <ObjectDisposedException>(() =>
                                                                    instance.AddLoginAsync(null, null).Wait());

            exception.ShouldNotBeNull();
            exception.ObjectName.ShouldEqual(instance.GetType().Name);
        }
Ejemplo n.º 6
0
        public void UserLoginStoreInterface_FindAsync_ThrowsWhenDisposed()
        {
            var instance = new SecurityStore(null) as IUserLoginStore <User, int>;

            instance.Dispose();
            var exception = Assert.Throws <ObjectDisposedException>(() =>
                                                                    instance.FindAsync(new UserLoginInfo("provider", "key")).GetAwaiter().GetResult());

            exception.ShouldNotBeNull();
            exception.ObjectName.ShouldEqual(instance.GetType().Name);
        }
Ejemplo n.º 7
0
        public void UserStoreInterface_FindByIdAsync_ThrowsWhenDisposed()
        {
            var instance = new SecurityStore(null) as IUserStore <User, int>;

            instance.Dispose();
            var exception = Assert.Throws <ObjectDisposedException>(() =>
                                                                    instance.FindByIdAsync(new Random().Next(0, int.MaxValue)).Result);

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