Exemple #1
0
        public void RemainingTimeTest()
        {
            var brainstormingDalMock = BrainstormingDalMock(1);

            brainstormingDalMock.SetupSequence(req => req.GetRemainingTime(It.IsAny <string>(), It.IsAny <string>()))
            .Returns(TimeSpan.FromSeconds(10))
            .Returns(TimeSpan.FromSeconds(5));
            var teamDalMock = TeamDalMock();

            var dalMock = new Mock <IDalService>();

            dalMock.Setup(serv => serv.BrainstormingDalService).Returns(brainstormingDalMock.Object);
            dalMock.Setup(serv => serv.TeamDalService).Returns(teamDalMock.Object);

            var brainstormingService = new BrainstormingService(
                _logMock,
                dalMock.Object,
                BrainstormingModelFactory.CreateContext(1),
                new BrainstormingModel());

            brainstormingService.StartBusinessService();
            Thread.Sleep(1100);
            var remainingTime = brainstormingService.RemainingTime;

            Thread.Sleep(1100);
            Assert.IsTrue(remainingTime > brainstormingService.RemainingTime);
        }
Exemple #2
0
        public void TestSendBrainWave()
        {
            BrainstormingService brainstormingService = BasicServiceSetup();

            brainstormingService.StartBusinessService();

            Assert.IsFalse(brainstormingService.BrainWaveSent);
            brainstormingService.SendBrainWave();
            Assert.IsTrue(brainstormingService.BrainWaveSent);
            Assert.IsTrue(brainstormingService.IsRunning);
            Thread.Sleep(7000);
            Assert.IsTrue(brainstormingService.IsEnded);
        }
Exemple #3
0
        public void EndedStateTest()
        {
            var brainstormingDalMock = BrainstormingDalMock(-1);
            var teamDalMock          = TeamDalMock();

            var dalMock = new Mock <IDalService>();

            dalMock.Setup(serv => serv.BrainstormingDalService).Returns(brainstormingDalMock.Object);
            dalMock.Setup(serv => serv.TeamDalService).Returns(teamDalMock.Object);

            var brainstormingService = new BrainstormingService(
                _logMock,
                dalMock.Object,
                BrainstormingModelFactory.CreateContext(-1),
                new BrainstormingModel());

            brainstormingService.StartBusinessService();
            Assert.IsTrue(brainstormingService.IsEnded);
            Assert.IsFalse(brainstormingService.IsWaiting);
            Assert.IsFalse(brainstormingService.IsRunning);
        }
Exemple #4
0
        public void StartRoundTest()
        {
            var brainstormingDalMock = BrainstormingDalMock(1);
            var teamDalMock          = TeamDalMock();

            var dalMock = new Mock <IDalService>();

            dalMock.Setup(serv => serv.BrainstormingDalService).Returns(brainstormingDalMock.Object);
            dalMock.Setup(serv => serv.TeamDalService).Returns(teamDalMock.Object);

            var brainstormingService = new BrainstormingService(
                _logMock,
                dalMock.Object,
                BrainstormingModelFactory.CreateContext(0),
                new BrainstormingModel());

            brainstormingService.StartBusinessService();
            Assert.IsTrue(brainstormingService.IsWaiting);
            Thread.Sleep(4500);
            Assert.IsTrue(brainstormingService.IsRunning);
        }