Exemplo n.º 1
0
        public void BeforeEachTest()
        {
            SimulatedNow = DateTime.UtcNow;

            ControllerInformationProvider = Substitute.For<IControllerInformationProvider>();
            ControllerInformationProvider.UtcNow.Returns(SimulatedNow);
            SetExpectations(ControllerInformationProvider);

            var cookie = new VotingCookie {Name = CookieName, Id = CookieId};
            ControllerInformationProvider.GetVotingCookie().Returns(cookie);

            sessionVoteModelQuery = Substitute.For<ISessionVoteModelQuery>();
            MessageBus = Substitute.For<IMessageBus>();

            Controller = new VoteController(MessageBus, sessionVoteModelQuery, ControllerInformationProvider);
        }
Exemplo n.º 2
0
        public void BeforeEachTest()
        {
            SimulatedNow = DateTime.UtcNow;

            ControllerInformationProvider = Substitute.For <IControllerInformationProvider>();
            ControllerInformationProvider.UtcNow.Returns(SimulatedNow);
            SetExpectations(ControllerInformationProvider);

            var cookie = new VotingCookie {
                Name = CookieName, Id = CookieId
            };

            ControllerInformationProvider.GetVotingCookie().Returns(cookie);

            sessionVoteModelQuery = Substitute.For <ISessionVoteModelQuery>();
            MessageBus            = Substitute.For <IMessageBus>();

            Controller = new VoteController(MessageBus, sessionVoteModelQuery, ControllerInformationProvider);
        }
Exemplo n.º 3
0
        public VoteController(IMessageBus messageBus,
                              ISessionVoteModelQuery sessionVoteModelQuery,
                              IControllerInformationProvider controllerInformationProvider)
        {
            if (messageBus == null)
            {
                throw new ArgumentNullException("messageBus");
            }

            if (sessionVoteModelQuery == null)
            {
                throw new ArgumentNullException("sessionVoteModelQuery");
            }

            if (controllerInformationProvider == null)
            {
                throw new ArgumentNullException("controllerInformationProvider");
            }

            this.messageBus                    = messageBus;
            this.sessionVoteModelQuery         = sessionVoteModelQuery;
            this.controllerInformationProvider = controllerInformationProvider;
        }
Exemplo n.º 4
0
        public VoteController(IMessageBus messageBus, 
            ISessionVoteModelQuery sessionVoteModelQuery,
            IControllerInformationProvider controllerInformationProvider)
        {
            if (messageBus == null)
            {
                throw new ArgumentNullException("messageBus");
            }

            if (sessionVoteModelQuery == null)
            {
                throw new ArgumentNullException("sessionVoteModelQuery");
            }

            if (controllerInformationProvider == null)
            {
                throw new ArgumentNullException("controllerInformationProvider");
            }

            this.messageBus = messageBus;
            this.sessionVoteModelQuery = sessionVoteModelQuery;
            this.controllerInformationProvider = controllerInformationProvider;
        }