public void PrintsConfig()
        {
            const string simpleConfig =
                @"#comment
key1=value1
key2=value2
";

//            const string expectedOutputPattern =
//@"Main config file\: .+\\config.cfg
//Override config file\: N/A
//Values\:
//KEY1\=value1
//KEY2\=value2
//End";

            using (DirectoryHandle tempDir1 = TempDirectoriesFactory.CreateEmpty())
            {
                var localCfgPath = Path.Combine(tempDir1.AbsolutePath, "config.cfg");
                File.WriteAllText(localCfgPath, simpleConfig);
                FileSimpleConfig localConfig = new FileSimpleConfig(localCfgPath);
                var result = localConfig.ToString();
                //verify manually if needed
            }
        }
Exemplo n.º 2
0
 public void Setup()
 {
     testDir       = TempDirectoriesFactory.CreateEmpty();
     pathDaily     = Path.Combine(testDir.AbsolutePath, "_event.2014-01-01.txt");
     pathMonthly   = Path.Combine(testDir.AbsolutePath, "_event.2014-01.txt");
     monthlyWriter = new LogWriter(pathDaily, new DateTime(2014, 1, 1), false);
     dailyWriter   = new LogWriter(pathMonthly, new DateTime(2014, 1, 1), false);
 }
Exemplo n.º 3
0
 public WurmClientMock PopulateFromZip(string zipFileFullPath)
 {
     using (var handle = TempDirectoriesFactory.CreateByUnzippingFile(zipFileFullPath))
     {
         PopulateFromDir(handle.AbsolutePath);
     }
     return(this);
 }
Exemplo n.º 4
0
        public void Setup()
        {
            tempDir = TempDirectoriesFactory.CreateEmpty();

            container = new MockingContainer <ChangelogManager>();
            container.Arrange <IBinDirectory>(directory => directory.FullPath).Returns(tempDir.FullName);

            WriteSampleChangelog();
        }
        public WurmApiIntegrationFixtureV2(Platform targetPlatform)
        {
            this.targetPlatform = targetPlatform;

            var handle = TempDirectoriesFactory.CreateEmpty();
            WurmApiDataDir = new DirectoryInfo(handle.AbsolutePath);
            WurmClientMock = WurmClientMockBuilder.Create(targetPlatform);
            LoggerMock = Mock.Create<IWurmApiLogger>().RedirectToTraceOut(true);
            HttpWebRequestsMock = Mock.Create<IHttpWebRequests>();
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public void CreateEmpty_CreatesAndCleanups()
        {
            DirectoryHandle dirhandle;

            using (
                dirhandle = TempDirectoriesFactory.CreateEmpty())
            {
                Expect(dirhandle.Exists, "Directory not created");
            }
            Expect(!dirhandle.Exists, "Directory not deleted");
        }
Exemplo n.º 8
0
        public void CreateByCopy_WithRelativePath_CreatesAndCleanups()
        {
            DirectoryHandle dirhandle;

            using (
                dirhandle =
                    TempDirectoriesFactory.CreateByCopy(Path.Combine(LocalTestResourcePath, "SampleSourceDir")))
            {
                Expect(dirhandle.Exists, "Directory not created");
                Expect(dirhandle.GetFiles().Count(), GreaterThan(0), "No files in temp directory");
            }
            Expect(!dirhandle.Exists, "Directory not deleted");
        }
Exemplo n.º 9
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");
        }
Exemplo n.º 10
0
        public void CreateByCopy_WithAbsolutePath_CreatesAndCleanups()
        {
            DirectoryHandle dirhandle;

            using (
                dirhandle =
                    TempDirectoriesFactory.CreateByCopy(Path.Combine(TestContext.CurrentContext.TestDirectory,
                                                                     "TempDirectoriesTests", "SampleSourceDir")))
            {
                Expect(dirhandle.Exists, "Directory not created");
                Expect(dirhandle.GetFiles().Count(), GreaterThan(0), "No files in temp directory");
            }
            Expect(!dirhandle.Exists, "Directory not deleted");
        }
Exemplo n.º 11
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");
        }
        public void FormatForFileNameUniversal_ParseFromFileNameUniversal_LocalTime_ExtensionlessFile()
        {
            using (var tempDir = TempDirectoriesFactory.CreateEmpty())
            {
                var date = new DateTimeOffset(2015, 09, 16, 22, 45, 15, 456, TimeSpan.FromHours(-4));

                var str  = date.FormatForFileNameUniversal();
                var file = new FileInfo(Path.Combine(tempDir.FullName, str));
                File.WriteAllText(file.FullName, "test");
                var parsedDate = DateTimeExtensions.ParseFromFileNameUniversal(file);

                Expect(parsedDate, EqualTo(date));
            }
        }
Exemplo n.º 13
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"));
        }
Exemplo n.º 14
0
        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);
        }
        public void FormatForFileNameUniversal_ParseFromFileNameUniversal_LocalTime_DateTimeOvrl()
        {
            using (var tempDir = TempDirectoriesFactory.CreateEmpty())
            {
                var date         = new DateTime(2015, 09, 16, 22, 45, 15, 456, DateTimeKind.Local);
                var dateAsOffset = new DateTimeOffset(date);

                var str  = date.FormatForFileNameUniversal();
                var file = new FileInfo(Path.Combine(tempDir.FullName, str + ".txt"));
                File.WriteAllText(file.FullName, "test");
                var parsedDate = DateTimeExtensions.ParseFromFileNameUniversal(file);

                Expect(parsedDate, EqualTo(dateAsOffset));
            }
        }
Exemplo n.º 16
0
 public void ReadsOverridesFromDifferentLocation()
 {
     using (DirectoryHandle tempDir1 = TempDirectoriesFactory.CreateEmpty())
     {
         using (DirectoryHandle tempDir2 = TempDirectoriesFactory.CreateEmpty())
         {
             var localCfgPath    = Path.Combine(tempDir1.AbsolutePath, "config.cfg");
             var localCfgUsrPath = Path.Combine(tempDir2.AbsolutePath, "config.cfg.usr");
             File.WriteAllText(localCfgPath, SampleConfig);
             File.WriteAllText(localCfgUsrPath, OverrideConfig);
             FileSimpleConfig localConfig = new FileSimpleConfig(localCfgPath, localCfgUsrPath);
             Expect(localConfig.HasValue("key to be overriden"));
             Expect(localConfig.GetValue("key to be overriden"), EqualTo("overriden value"));
         }
     }
 }
Exemplo n.º 17
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");
        }
Exemplo n.º 18
0
 public void Setup()
 {
     tempDir    = TempDirectoriesFactory.CreateEmpty();
     cfgPath    = Path.Combine(tempDir.AbsolutePath, "config.cfg");
     cfgUsrPath = Path.Combine(tempDir.AbsolutePath, "config.cfg.usr");
 }
 public void Setup()
 {
     dirHandle = TempDirectoriesFactory.CreateEmpty();
     strategy  = CreatePersistenceStrategy();
 }
Exemplo n.º 20
0
 public void BaseSetup()
 {
     directoryHandle = TempDirectoriesFactory.CreateEmpty();
 }
Exemplo n.º 21
0
        public static WurmClientMock Create(Platform targetPlatform = Platform.Windows)
        {
            var dir = TempDirectoriesFactory.CreateEmpty();

            return(new WurmClientMock(dir, true, targetPlatform));
        }
Exemplo n.º 22
0
        public static WurmClientMock CreateWithoutBasicDirs(Platform targetPlatform = Platform.Windows)
        {
            var dir = TempDirectoriesFactory.CreateEmpty();

            return(new WurmClientMock(dir, false, targetPlatform));
        }
Exemplo n.º 23
0
 public void Setup()
 {
     dir = TempDirectoriesFactory.CreateEmpty();
     flatFilesDataStorage = new FlatFilesDataStorage(dir.FullName);
 }
Exemplo n.º 24
0
 public void Setup()
 {
     TempDir = TempDirectoriesFactory.CreateEmpty();
 }
 public void Setup()
 {
     DataDir = TempDirectoriesFactory.CreateEmpty();
     var lib = new PersistentCollectionsLibrary(new FlatFilesPersistenceStrategy(DataDir.AbsolutePath));
     System = new SortedServerHistory(lib.DefaultCollection.GetObject<WurmApi.Modules.Wurm.ServerHistory.PersistentModel.ServerHistory>("default"));
 }
Exemplo n.º 26
0
 public void AutoCleanupsOnAppDomainExit()
 {
     TempDirectoriesFactory.CreateEmpty();
     // dir should not be there after testing finishes and finalizers run on manager
 }
Exemplo n.º 27
0
 public void Setup()
 {
     dir = TempDirectoriesFactory.CreateEmpty();
     sqLiteDataStorage = new SqLiteDataStorage(dir.FullName);
 }
Exemplo n.º 28
0
 public virtual void Setup()
 {
     dir = TempDirectoriesFactory.CreateEmpty();
 }