示例#1
0
        public void FileDelete_NoStatusOrDone_ThrowsException()
        {
            var file = new File("symitar", "000", "RandomFile", FileType.RepGen, DateTime.Now, 100);

            var mockSocket = Substitute.For <ISymSocket>();

            mockSocket.ReadCommand().Returns(new SymCommand("Unknown"));

            var session = new SymSession(mockSocket, 10);

            Assert.Throws <Exception>(() => session.FileDelete("RandomFile", FileType.RepGen));
        }
示例#2
0
        public void FileDelete_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.FileDelete("RandomFile", FileType.RepGen));
        }
示例#3
0
        public void FileDelete_StatusUnknown_ThrowsFileNotFoundException()
        {
            var file = new File("symitar", "000", "RandomFile", FileType.RepGen, DateTime.Now, 100);

            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.FileDelete("RandomFile", FileType.RepGen), "Filename Too Long");
        }
示例#4
0
        public void FileDelete_StatusUnknown_ThrowsFileNotFoundException()
        {
            var file = new File("symitar", "000", "RandomFile", FileType.RepGen, DateTime.Now, 100);

            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.FileDelete("RandomFile", FileType.RepGen), "Filename Too Long");
        }
示例#5
0
        public void FileDelete_NoStatusOrDone_ThrowsException()
        {
            var file = new File("symitar", "000", "RandomFile", FileType.RepGen, DateTime.Now, 100);

            var mockSocket = Substitute.For<ISymSocket>();
            mockSocket.ReadCommand().Returns(new SymCommand("Unknown"));

            var session = new SymSession(mockSocket, 10);

            Assert.Throws<Exception>(() => session.FileDelete("RandomFile", FileType.RepGen));
        }
示例#6
0
        public void FileDelete_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.FileDelete("RandomFile", FileType.RepGen));
        }