public void IsFileRunning_ZeroSequence_ThrowsOutOfRange() { var mockSocket = Substitute.For<ISymSocket>(); var session = new SymSession(mockSocket); Assert.Throws<ArgumentOutOfRangeException>(() => session.IsFileRunning(0)); }
public void IsFileRunning_ZeroSequence_ThrowsOutOfRange() { var mockSocket = Substitute.For <ISymSocket>(); var session = new SymSession(mockSocket); Assert.Throws <ArgumentOutOfRangeException>(() => session.IsFileRunning(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(); }
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(); }
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(); }
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(); }
//======================================================================== 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; }