Esempio n. 1
0
        public void UserLoginStoreInterface_AddLoginAsync_ThrowsArgumentNullException_WhenUserLoginInfoIsNull()
        {
            var instance  = new SecurityStore(null) as IUserLoginStore <User, int>;
            var exception = Assert.Throws <ArgumentNullException>(() =>
                                                                  instance.AddLoginAsync(new User(), null).Wait());

            exception.ShouldNotBeNull();
            exception.ParamName.ShouldEqual("login");
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public void UserLoginStoreInterface_AddLoginAsync_DelegatesToDataDependency()
        {
            var entities = new Mock <IWriteEntities>(MockBehavior.Strict);
            var instance = new SecurityStore(entities.Object) as IUserLoginStore <User, int>;
            var user     = new FakeUser(6);
            var login    = new UserLoginInfo(Guid.NewGuid().ToString(), Guid.NewGuid().ToString());
            Expression <Func <RemoteMembership, bool> > expectedEntity = x => x.UserId == user.Id &&
                                                                         x.LoginProvider == login.LoginProvider && x.ProviderKey == login.ProviderKey;

            entities.Setup(x => x.Create(It.Is(expectedEntity)));
            instance.AddLoginAsync(user, login);
            entities.Verify(x => x.Create(It.Is(expectedEntity)), Times.Once);
        }