public void TestInitialize()
        {
            string password = "******";

            var newCreatePortfolioRequest = new CreatePortfolioRequestMessage
            {
                ConfirmPassword = password
            };
        }
        public void SerializeTest()
        {
            string password = "******";

            var newCreatePortfolioRequest = new CreatePortfolioRequestMessage
            {
                ConfirmPassword = password
            };

            var serializedMessage = MessageFactory.GetMessage(newCreatePortfolioRequest.Encode(), false) as CreatePortfolioRequestMessage;

            Assert.AreEqual(newCreatePortfolioRequest.ConfirmPassword, serializedMessage.ConfirmPassword);
        }
Ejemplo n.º 3
0
        public void RequestSucceed()
        {
            string PortName      = "IamAUsername";
            string PortPass      = "******";
            string RequestConvId = "5-567";
            string ClientIp      = "192.168.1.75";
            int    ClientPort    = 5655;

            var RequestMessage = new CreatePortfolioRequestMessage()
            {
                ConversationID = RequestConvId,
                MessageID      = RequestConvId,
                Account        = new Portfolio
                {
                    Username = PortName,
                    Password = PortPass
                },
                ConfirmPassword = PortPass
            };

            Envelope IncomingRequest = new Envelope(RequestMessage, ClientIp, ClientPort);

            var localConv = ConversationManager.GetConversation(RequestConvId);

            Assert.IsNull(localConv);
            Assert.IsNull(mock);

            Assert.IsTrue(PortfolioManager.Portfolios.Count == 0);

            ConversationManager.ProcessIncomingMessage(IncomingRequest);

            Assert.IsTrue(PortfolioManager.Portfolios.Count == 1);
            Portfolio localPortfolio = PortfolioManager.Portfolios.First().Value;

            Assert.AreEqual(PortName, localPortfolio.Username);
            Assert.AreEqual(PortPass, localPortfolio.Password);

            localConv = ConversationManager.GetConversation(RequestConvId);

            Assert.IsNotNull(localConv);
            Assert.IsNotNull(localConv.CurrentState.PreviousState.OutboundMessage.Contents as PortfolioUpdateMessage);

            Assert.IsTrue(localConv.CurrentState is ConversationDoneState);
            mock.Verify(state => state.Prepare(), Times.Once);
            mock.Verify(state => state.Send(), Times.Once);
            mock.Verify(state => state.HandleTimeout(), Times.Never);

            Assert.IsTrue(PortfolioManager.TryToRemove(localPortfolio.PortfolioID));
        }
        public void InheritsGetPortfolioRequestTest()
        {
            var newCreatePortfolioRequest = new CreatePortfolioRequestMessage();

            Assert.IsNull(newCreatePortfolioRequest.Account);
        }
        public void DefaultConstructorTest()
        {
            var newCreatePortfolioRequest = new CreatePortfolioRequestMessage();

            Assert.IsNull(newCreatePortfolioRequest.ConfirmPassword);
        }