Ejemplo n.º 1
0
        public void ErrPasswordMismatch()
        {
            IsReadOnlyTest = true;
            const long userId = (long)SetupUserId.Zach;

            var op = new WebUpdateUserPasswordOperation();

            TestUtil.Throws <FabPreventedFault>(() => op.Execute(OpCtx, userId, "x", "newPassword"));
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            vUser          = new User();
            vUser.VertexId = 1234125;
            vOldPass       = "******";
            vNewPass       = "******";

            vMockData = new Mock <IOperationData>(MockBehavior.Strict);
            vMockData.Setup(x => x.GetVertexById <User>(vUser.VertexId)).Returns(vUser);

            vMockOpCtx = new Mock <IOperationContext>(MockBehavior.Strict);
            vMockOpCtx.SetupGet(x => x.Data).Returns(vMockData.Object);

            vOper = new WebUpdateUserPasswordOperation();
        }
Ejemplo n.º 3
0
        public void Success()
        {
            const long   userId  = (long)SetupUserId.Zach;
            const string newPass = "******";

            var           op     = new WebUpdateUserPasswordOperation();
            SuccessResult result = op.Execute(OpCtx, userId, "asdfasdf", newPass);

            Assert.NotNull(result, "Result should be filled.");
            Assert.True(result.Success, "Incorrect Success.");

            IWeaverQuery verify = Weave.Inst.Graph
                                  .V.ExactIndex <User>(x => x.VertexId, userId)
                                  .Has(x => x.Password, WeaverStepHasOp.EqualTo, DataUtil.HashPassword(newPass))
                                  .ToQuery();

            VerificationQueryFunc = () => {
                IDataResult dr = OpCtx.ExecuteForTest(verify, "UpdateUserPassword-Verify");
                Assert.AreEqual(1, dr.GetCommandResultCount(), "New element not verified.");
            };
        }