public void FileCheck_ActionFileInfo_FailsCheck() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand() .Returns( new SymCommand("Check", new Dictionary <string, string> { { "Action", "Init" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "Init" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "Init" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "Init" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "FileInfo" }, { "Line", "22" }, { "Col", "1" } }), new SymCommand("Check", new Dictionary <string, string> { { "Action", "DisplayEdit" } }) ); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); SpecfileResult result = session.FileCheck(file); result.PassedCheck.Should().BeFalse(); }
public void FileCheck_LetterFile_ThrowsException() { var mockSocket = Substitute.For<ISymSocket>(); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.Letter, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); Assert.Throws<Exception>(() => session.FileCheck(file)); }
public void FileCheck_LetterFile_ThrowsException() { var mockSocket = Substitute.For <ISymSocket>(); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.Letter, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); Assert.Throws <Exception>(() => session.FileCheck(file)); }
public void FileCheck_CommandHasWarning_ThrowsFileNotFoundException() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Check", new Dictionary<string, string> {{"Warning", ""}})); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); Assert.Throws<FileNotFoundException>(() => session.FileCheck(file)); }
public void FileCheck_ActionNoError_PassesCheck() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Check", new Dictionary<string, string> {{"Action", "NoError"}})); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); SpecfileResult result = session.FileCheck(file); result.PassedCheck.Should().BeTrue(); }
public void FileCheck_CommandHasWarning_ThrowsFileNotFoundException() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Check", new Dictionary <string, string> { { "Warning", "" } })); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); Assert.Throws <FileNotFoundException>(() => session.FileCheck(file)); }
public void FileCheck_UnknownCommands_ThrowsException() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Check", new Dictionary <string, string> { { "Action", "Random" } })); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); Assert.Throws <Exception>(() => session.FileCheck(file), "An unknown error occurred."); }
public void FileCheck_ActionNoError_PassesCheck() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Check", new Dictionary <string, string> { { "Action", "NoError" } })); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); SpecfileResult result = session.FileCheck(file); result.PassedCheck.Should().BeTrue(); }
public void FileCheck_ActionFileInfo_FailsCheck() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand() .Returns( new SymCommand("Check", new Dictionary<string, string> {{"Action", "Init"}}), new SymCommand("Check", new Dictionary<string, string> {{"Action", "Init"}}), new SymCommand("Check", new Dictionary<string, string> {{"Action", "Init"}}), new SymCommand("Check", new Dictionary<string, string> {{"Action", "Init"}}), new SymCommand("Check", new Dictionary<string, string> {{"Action", "FileInfo"},{"Line", "22"},{"Col", "1"}}), new SymCommand("Check", new Dictionary<string, string> {{"Action", "DisplayEdit"}}) ); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); SpecfileResult result = session.FileCheck(file); result.PassedCheck.Should().BeFalse(); }
public void FileCheck_UnknownCommands_ThrowsException() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Check", new Dictionary<string, string> {{"Action", "Random"}})); var file = new File("symitar", "10", "FILE.TO.CHECK", FileType.RepGen, DateTime.Now, 110); var session = new SymSession(mockSocket, 10); Assert.Throws<Exception>(() => session.FileCheck(file), "An unknown error occurred."); }