public void FileRename_NoStatusOrDone_ThrowsException() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand().Returns(new SymCommand("Unknown")); var session = new SymSession(mockSocket, 10); Assert.Throws <Exception>(() => session.FileRename("OldName", "NewName", FileType.RepGen)); }
public void FileRename_StatusNoSuchFile_ThrowsFileNotFoundException() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand().Returns(new SymCommand("Rename", new Dictionary <string, string> { { "Status", "No such file or directory" } })); var session = new SymSession(mockSocket, 10); Assert.Throws <FileNotFoundException>(() => session.FileRename("OldName", "NewName", FileType.RepGen)); }
public void FileRename_StatusUnknown_ThrowsFileNotFoundException() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand().Returns(new SymCommand("Rename", new Dictionary <string, string> { { "Status", "" } })); var session = new SymSession(mockSocket, 10); Assert.Throws <Exception>(() => session.FileRename("OldName", "NewName", FileType.RepGen), "Filename Too Long"); }
public void FileRename_CompletesSuccessfully_NoExceptions() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Rename", new Dictionary <string, string> { { "Done", "" } })); var session = new SymSession(mockSocket, 10); Assert.DoesNotThrow(() => session.FileRename("OldName", "NewName", FileType.RepGen)); }
public void FileRename_StatusUnknown_ThrowsFileNotFoundException() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand().Returns(new SymCommand("Rename", new Dictionary<string, string> {{"Status", ""}})); var session = new SymSession(mockSocket, 10); Assert.Throws<Exception>(() => session.FileRename("OldName", "NewName", FileType.RepGen), "Filename Too Long"); }
public void FileRename_StatusNoSuchFile_ThrowsFileNotFoundException() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand().Returns(new SymCommand("Rename", new Dictionary<string, string> {{"Status", "No such file or directory"}})); var session = new SymSession(mockSocket, 10); Assert.Throws<FileNotFoundException>(() => session.FileRename("OldName", "NewName", FileType.RepGen)); }
public void FileRename_NoStatusOrDone_ThrowsException() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand().Returns(new SymCommand("Unknown")); var session = new SymSession(mockSocket, 10); Assert.Throws<Exception>(() => session.FileRename("OldName", "NewName", FileType.RepGen)); }
public void FileRename_CompletesSuccessfully_NoExceptions() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("Rename", new Dictionary<string, string> {{"Done", ""}})); var session = new SymSession(mockSocket, 10); Assert.DoesNotThrow(() => session.FileRename("OldName", "NewName", FileType.RepGen)); }