Beispiel #1
0
        public void SignUpWithExistedName()
        {
            userDbMocker.Setup(x => x.IsUserNameExist(It.IsAny <string>())).Returns(true);
            slave = new SignUpSlave(guestUser, userDbMocker.Object, publisherMocker.Object);
            User user = slave.SignUp(registeredUserName, registeredUserAddress, registeredUserPassword,
                                     registeredUserCreditCard);

            BadSignUpToDataCompare(user);
        }
Beispiel #2
0
        public void DidntEnteredSystemTest()
        {
            slave = new SignUpSlave(null, userDbMocker.Object, publisherMocker.Object);
            User user = slave.SignUp(registeredUserName, registeredUserAddress, registeredUserPassword,
                                     registeredUserCreditCard);

            Assert.IsNull(user);
            Assert.AreEqual(0, counterQueueAdded);
        }
Beispiel #3
0
        public void SignUpAgainTest()
        {
            User user = slave.SignUp(registeredUserName, registeredUserAddress, registeredUserPassword, registeredUserCreditCard);

            slave = new SignUpSlave(user, userDbMocker.Object, publisherMocker.Object);
            user  = slave.SignUp("some other name", registeredUserAddress, registeredUserPassword,
                                 registeredUserCreditCard);
            object[] expected = { registeredUserID, registeredUserName, registeredUserAddress, encryptedUserPassword,
                                  registeredUserCreditCard };
            object[] actual = user.ToData();
            CompareUserToData(expected, actual);
            Assert.AreEqual(1, counterQueueAdded);
        }
Beispiel #4
0
 public void MarketBuilder()
 {
     marketDbMocker    = new Mock <IMarketBackUpDB>();
     publisherMocker   = new Mock <IPublisher>();
     counterQueueAdded = 0;
     publisherMocker.Setup(x => x.AddFeedQueue(It.IsAny <int>())).Callback(addQueueCheck);
     MarketException.SetDB(marketDbMocker.Object);
     MarketLog.SetDB(marketDbMocker.Object);
     userDbMocker = new Mock <IUserDL>();
     userDbMocker.Setup(x => x.RegisterUser(It.IsAny <int>(), It.IsAny <string>(),
                                            It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CartItem[]>()))
     .Returns(new RegisteredUser(userDbMocker.Object, registeredUserID, registeredUserName, registeredUserAddress,
                                 encryptedUserPassword, registeredUserCreditCard, new CartItem[0]));
     userDbMocker.Setup(x => x.IsUserNameExist(It.IsAny <string>())).Returns(false);
     guestUser = new User(userDbMocker.Object, registeredUserID);
     slave     = new SignUpSlave(guestUser, userDbMocker.Object, publisherMocker.Object);
 }