Example #1
0
 public WurmClientMock PopulateFromZip(string zipFileFullPath)
 {
     using (var handle = TempDirectoriesFactory.CreateByUnzippingFile(zipFileFullPath))
     {
         PopulateFromDir(handle.AbsolutePath);
     }
     return(this);
 }
Example #2
0
        public void Setup()
        {
            sourceSoundsDir = TempDirectoriesFactory.CreateByUnzippingFile(Path.Combine("Resources", "sounds_wav.7z"));
            dataDir         = TempDirectoriesFactory.CreateEmpty();
            var waDataDir = Mock.Create <IWurmAssistantDataDirectory>();

            waDataDir.Arrange(directory => directory.DirectoryPath).Returns(dataDir.FullName);
            Kernel.Bind <IWurmAssistantDataDirectory>().ToConstant(waDataDir);
            soundBankDir = Path.Combine(dataDir.FullName, SoundsLibrary.SoundbankDirName);
        }
Example #3
0
        public void CreateByUnzippingFile_WithAbsolutePath_CreatesAndCleanups()
        {
            DirectoryHandle dirhandle;

            using (
                dirhandle =
                    TempDirectoriesFactory.CreateByUnzippingFile(Path.Combine(TestContext.CurrentContext.TestDirectory,
                                                                              LocalTestResourcePath, "SampleZippedDir.7z")))
            {
                Expect(dirhandle.Exists, "Directory not created");
                Expect(dirhandle.GetFiles().Count(), GreaterThan(0), "No files in temp directory");
            }
            Expect(!dirhandle.Exists, "Directory not deleted");
        }
Example #4
0
        public void CreateByUnzippingFile_WithRelativePath_CreatesAndCleanups()
        {
            DirectoryHandle dirhandle;

            using (
                dirhandle =
                    TempDirectoriesFactory.CreateByUnzippingFile(Path.Combine("TempDirectoriesTests",
                                                                              "SampleZippedDir.7z")))
            {
                Expect(dirhandle.Exists, "Directory not created");
                Expect(dirhandle.GetFiles().Count(), GreaterThan(0), "No files in temp directory");
            }
            Expect(!dirhandle.Exists, "Directory not deleted");
        }
        public virtual void Setup()
        {
            // gotcha: this will spam trace output with exceptions:
            Fixture.HttpWebRequestsMock.Arrange(requests => requests.GetResponseAsync(Arg.IsAny <string>()))
            .Throws <NotSupportedException>();

            HtmlWebRequestsDir =
                TempDirectoriesFactory.CreateByUnzippingFile(Path.Combine(TestPaksZippedDirFullPath,
                                                                          "WurmServerTests-wurmdir-webrequests.7z"));

            ClientMock.PopulateFromZip(Path.Combine(TestPaksZippedDirFullPath, "WurmServerTests-wurmdir.7z"));

            Timescope = TimeStub.CreateStubbedScope();
            Timescope.SetAllLocalTimes(MockedNow);
        }
Example #6
0
        public void Setup()
        {
            //logsDir = TempDirectoriesFactory.CreateByCopy(Path.Combine(TestPaksDirFullPath, "MonthlyHeuristicsExtractor-sample-logs"));
            logsDir = TempDirectoriesFactory.CreateByUnzippingFile(Path.Combine(TestPaksZippedDirFullPath, "MonthlyHeuristicsExtractor-sample-logs.7z"));
            string basePath = logsDir.AbsolutePath;

            testFile                    = new FileInfo(Path.Combine(basePath, "Village.2013-03.txt"));
            emptyTestFile               = new FileInfo(Path.Combine(basePath, "Village.2013-03.empty.txt"));
            invalidTestFile             = new FileInfo(Path.Combine(basePath, "Village.2013-03.invaliddata.txt"));
            unrecognizedTestFile        = new FileInfo(Path.Combine(basePath, "unrecognized.txt"));
            dailyLogFile                = new FileInfo(Path.Combine(basePath, "Village.2012-10-24.txt"));
            fileWithBadStamp            = new FileInfo(Path.Combine(basePath, "_Skills.2012-08.txt"));
            fileThatGoesBeyondMonthDays = new FileInfo(Path.Combine(basePath, "Village.2013-04.txt"));
            fileEvent201412             = new FileInfo(Path.Combine(basePath, "_Event.2014-12.txt"));
        }
Example #7
0
        public void Setup()
        {
            wurmApiConfig = new WurmApiConfig {
                Platform = Platform.Linux
            };

            system = new LogFileStreamReaderFactory(wurmApiConfig);

            ubuntuDir = TempDirectoriesFactory.CreateByUnzippingFile(Path.Combine(TestPaksZippedDirFullPath,
                                                                                  "ubuntu-wurm-dir.7z"));

            sampleLogFilePath = Path.Combine(ubuntuDir.AbsolutePath,
                                             "players",
                                             "aldur",
                                             "logs",
                                             "_Event.2015-08.txt");
        }