Ejemplo n.º 1
0
                /// <summary>Processes pointed file.</summary>
                /// <param name="fileName">The name of a file.</param>
                public void ProcessFile(string fileName)
                {
                    m_ProjectFileStateMachineImpl = new ProjectFileStateMachineImpl(fileName);
                    SetProgressRange(0, m_ProjectFileStateMachineImpl.GetLinesCount());

                    Start();
                }
Ejemplo n.º 2
0
            public void ProjectFileStateMachineHappyPath()
            {
                string testFileName = "Forms/TestInputFile.txt";
                ProjectFileStateMachineImpl stateMachine = new ProjectFileStateMachineImpl(testFileName);
                int linesCount = System.IO.File.ReadAllLines(testFileName).GetLength(0);

                Assert.IsNotNull(stateMachine);
                Assert.IsTrue(stateMachine.GetCurrentState().GetStateId() == BaseState.StateId.CREATED_STATE);
                Assert.IsTrue(stateMachine.GetCurrentLine() == 0);
                Assert.IsTrue(stateMachine.GetLinesCount() == linesCount);
                while (stateMachine.ProcessInput())
                {
                    Assert.IsTrue(stateMachine.GetCurrentState().GetStateId() == BaseState.StateId.PROCESSING_STATE);
                }
                Assert.IsTrue(stateMachine.GetCurrentLine() == linesCount);
                Assert.IsTrue(stateMachine.GetCurrentState().GetStateId() == BaseState.StateId.FINISHED_STATE);
            }