Beispiel #1
0
        public void TestSimulationFailingCallAssignment()
        {
            Call call = new Call(PriorityLevel.Low, 1, "TestCaller");

            Mock <ICallManager> callManagerMock = new Mock <ICallManager>();

            callManagerMock.SetupSequence(cm => cm.HasUnhandledCalls())
            .Returns(true)
            .Returns(false);
            callManagerMock.Setup(cm => cm.GetNextCall())
            .Returns(call);

            Mock <IEmployeeManager> employeeManagerMock = new Mock <IEmployeeManager>();

            employeeManagerMock.Setup(em => em.DispatchCall(call))
            .Returns(false);
            employeeManagerMock.Setup(em => em.GetBusyEmployees())
            .Returns(new List <Employee>()
            {
            });

            DispatchSimulator.TriggerSimulation(callManagerMock.Object, employeeManagerMock.Object);

            callManagerMock.Verify(cm => cm.HasUnhandledCalls(), Times.Exactly(2));
            callManagerMock.Verify(cm => cm.GetNextCall(), Times.Once);
            employeeManagerMock.Verify(em => em.DispatchCall(call), Times.Once);
            employeeManagerMock.Verify(em => em.FinishCalls(), Times.Once);
            callManagerMock.Verify(cm => cm.ReAddCall(call), Times.Once);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                string employeeFile = args[0];

                EmployeeManager employeeManager = new EmployeeManager(6, employeeFile);
                CallManager     callManager     = new CallManager();
                DispatchSimulator.TriggerSimulation(callManager, employeeManager);
            }
            else
            {
                Logger.ErrorLog("No employees JSON file provided at command line.");
                Logger.ErrorLog("Usage: FireStationCallDispatcher.exe employees.json");
                Logger.ErrorLog("See the ../../../data directory for example files...");
                Logger.ErrorLog("Exiting.");
            }
        }