Пример #1
0
        public void IsFileRunning_ZeroSequence_ThrowsOutOfRange()
        {
            var mockSocket = Substitute.For<ISymSocket>();
            var session = new SymSession(mockSocket);

            Assert.Throws<ArgumentOutOfRangeException>(() => session.IsFileRunning(0));
        }
Пример #2
0
        public void IsFileRunning_ZeroSequence_ThrowsOutOfRange()
        {
            var mockSocket = Substitute.For <ISymSocket>();
            var session    = new SymSession(mockSocket);

            Assert.Throws <ArgumentOutOfRangeException>(() => session.IsFileRunning(0));
        }
Пример #3
0
        public void IsFileRunning_DoneImmediate_ReturnsFalse()
        {
            var mockSocket = Substitute.For<ISymSocket>();
            mockSocket.ReadCommand()
                .Returns(new SymCommand("Misc", new Dictionary<string, string> {{"Done", ""}}));

            var session = new SymSession(mockSocket);
            session.IsFileRunning(1).Should().BeFalse();
        }
Пример #4
0
        public void IsFileRunning_QueueEntryWithoutMatchingSeq_ReturnsTrue()
        {
            var mockSocket = Substitute.For<ISymSocket>();
            mockSocket.ReadCommand()
                .Returns(
                    new SymCommand("Misc",new Dictionary<string, string>{{"Action", "QueueEntry"},{"Seq", "11"}}),
                    new SymCommand("Misc", new Dictionary<string, string> {{"Done", ""}})
                );

            var session = new SymSession(mockSocket);
            session.IsFileRunning(1).Should().BeFalse();
        }
Пример #5
0
        public void IsFileRunning_DoneImmediate_ReturnsFalse()
        {
            var mockSocket = Substitute.For <ISymSocket>();

            mockSocket.ReadCommand()
            .Returns(new SymCommand("Misc", new Dictionary <string, string> {
                { "Done", "" }
            }));

            var session = new SymSession(mockSocket);

            session.IsFileRunning(1).Should().BeFalse();
        }
Пример #6
0
        public void IsFileRunning_QueueEntryWithoutMatchingSeq_ReturnsTrue()
        {
            var mockSocket = Substitute.For <ISymSocket>();

            mockSocket.ReadCommand()
            .Returns(
                new SymCommand("Misc", new Dictionary <string, string> {
                { "Action", "QueueEntry" }, { "Seq", "11" }
            }),
                new SymCommand("Misc", new Dictionary <string, string> {
                { "Done", "" }
            })
                );

            var session = new SymSession(mockSocket);

            session.IsFileRunning(1).Should().BeFalse();
        }
Пример #7
0
 //========================================================================
 private void CheckerWork(object sender, DoWorkEventArgs e)
 {
     while (running)
     {
         try
         {
             running = session.IsFileRunning(sequence);
             if (running)
             {
                 checker.ReportProgress(9);
                 Thread.Sleep(1000);
             }
         }
         catch (Exception ex)
         {
             running  = false;
             e.Result = ex.Message;
             return;
         }
     }
     e.Result = null;
 }