Esempio n. 1
0
        public void ShouldLoadConfigurationFileAtInitialize()
        {
            ApplicationController.ResetInstance();
            configManagerMock.ClearReceivedCalls();
            mainWindowViewModelMock.ClearReceivedCalls();
            configManagerMock.DidNotReceive().LoadConfigurationFromFile();
            configManagerMock.TaskTime.Returns(20);
            configManagerMock.BreakTime.Returns(5);
            configManagerMock.RepeatTime.Returns(2);
            configManagerMock.LongBreakTime.Returns(15);
            int taskTime      = -1;
            int breakTime     = -1;
            int repeatTime    = -1;
            int longBreakTime = -1;

            mainWindowViewModelMock.Configure(Arg.Do <IConfigManager>(c =>
            {
                taskTime      = c.TaskTime;
                breakTime     = c.BreakTime;
                repeatTime    = c.RepeatTime;
                longBreakTime = c.LongBreakTime;
            }));
            var newController = ApplicationController.Create();

            mainWindowViewModelMock.DidNotReceive().Configure(configManagerMock);
            newController.Initialize(serviceProvider);
            configManagerMock.Received().LoadConfigurationFromFile();
            mainWindowViewModelMock.Received().Configure(Arg.Any <IConfigManager>());
            Assert.AreEqual(20, taskTime);
            Assert.AreEqual(5, breakTime);
            Assert.AreEqual(2, repeatTime);
            Assert.AreEqual(15, longBreakTime);
        }