public void FileGet_HasOneMatch_ReturnsFile() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.Server.Returns("symitar"); mockSocket.ReadCommand() .Returns( new SymCommand("FileList", new Dictionary <string, string> { { "Name", "RandomFile" }, { "Date", "01012013" }, { "Time", "1153" }, { "Size", "1123" }, }), new SymCommand("FileList", new Dictionary <string, string> { { "Done", "" } }) ); var expected = new File("symitar", "10", "RandomFile", FileType.RepGen, "01012013", "1153", 1123); var session = new SymSession(mockSocket, 10); File actual = session.FileGet("RandomFile", FileType.RepGen); Assert.AreEqual(expected.Name, actual.Name); Assert.AreEqual(expected.Type, actual.Type); }
public void FileGet_NoMatches_ThrowsFileNotFound() { var mockSocket = Substitute.For <ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("FileList", new Dictionary <string, string> { { "Done", "" } })); var session = new SymSession(mockSocket, 10); Assert.Throws <FileNotFoundException>(() => session.FileGet("RandomFile", FileType.RepGen)); }
public void FileGet_NoMatches_ThrowsFileNotFound() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.ReadCommand() .Returns(new SymCommand("FileList", new Dictionary<string, string> {{"Done", ""}})); var session = new SymSession(mockSocket, 10); Assert.Throws<FileNotFoundException>(() => session.FileGet("RandomFile", FileType.RepGen)); }
public void FileGet_HasOneMatch_ReturnsFile() { var mockSocket = Substitute.For<ISymSocket>(); mockSocket.Server.Returns("symitar"); mockSocket.ReadCommand() .Returns( new SymCommand("FileList", new Dictionary<string, string> { {"Name", "RandomFile"}, {"Date", "01012013"}, {"Time", "1153"}, {"Size", "1123"}, }), new SymCommand("FileList", new Dictionary<string, string> {{"Done", ""}}) ); var expected = new File("symitar", "10", "RandomFile", FileType.RepGen, "01012013", "1153", 1123); var session = new SymSession(mockSocket, 10); File actual = session.FileGet("RandomFile", FileType.RepGen); Assert.AreEqual(expected.Name, actual.Name); Assert.AreEqual(expected.Type, actual.Type); }