Пример #1
0
        public void FileExistsByFile_FilesReturned_IsTrue()
        {
            var file = new File("symitar", "000", "RandomFile", FileType.RepGen, DateTime.Now, 100);

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

            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 session = new SymSession(mockSocket, 10);

            bool result = session.FileExists(file);

            result.Should().BeTrue();
        }
Пример #2
0
        public void FileExistsByName_NoFilesReturned_IsFalse()
        {
            var mockSocket = Substitute.For <ISymSocket>();

            mockSocket.ReadCommand()
            .Returns(new SymCommand("FileList", new Dictionary <string, string> {
                { "Done", "" }
            }));

            var session = new SymSession(mockSocket, 10);

            bool result = session.FileExists("RandomFile", FileType.RepGen);

            result.Should().BeFalse();
        }
Пример #3
0
        public void FileExistsByName_NoFilesReturned_IsFalse()
        {
            var mockSocket = Substitute.For<ISymSocket>();
            mockSocket.ReadCommand()
                      .Returns(new SymCommand("FileList", new Dictionary<string, string> {{"Done", ""}}));

            var session = new SymSession(mockSocket, 10);

            bool result = session.FileExists("RandomFile", FileType.RepGen);
            result.Should().BeFalse();
        }
Пример #4
0
        public void FileExistsByName_FilesReturned_IsTrue()
        {
            var mockSocket = Substitute.For<ISymSocket>();
            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 session = new SymSession(mockSocket, 10);

            bool result = session.FileExists("RandomFile", FileType.RepGen);
            result.Should().BeTrue();
        }