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
            }
        }
Пример #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);
 }
Пример #3
0
        public void Setup()
        {
            tempDir = TempDirectoriesFactory.CreateEmpty();

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

            WriteSampleChangelog();
        }
Пример #4
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);
        }
        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>();
        }
Пример #6
0
        public void CreateEmpty_CreatesAndCleanups()
        {
            DirectoryHandle dirhandle;

            using (
                dirhandle = TempDirectoriesFactory.CreateEmpty())
            {
                Expect(dirhandle.Exists, "Directory not created");
            }
            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));
            }
        }
        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));
            }
        }
 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"));
         }
     }
 }
 public void Setup()
 {
     dirHandle = TempDirectoriesFactory.CreateEmpty();
     strategy  = CreatePersistenceStrategy();
 }
Пример #11
0
 public void BaseSetup()
 {
     directoryHandle = TempDirectoriesFactory.CreateEmpty();
 }
Пример #12
0
        public static WurmClientMock Create(Platform targetPlatform = Platform.Windows)
        {
            var dir = TempDirectoriesFactory.CreateEmpty();

            return(new WurmClientMock(dir, true, targetPlatform));
        }
Пример #13
0
        public static WurmClientMock CreateWithoutBasicDirs(Platform targetPlatform = Platform.Windows)
        {
            var dir = TempDirectoriesFactory.CreateEmpty();

            return(new WurmClientMock(dir, false, targetPlatform));
        }
 public void Setup()
 {
     tempDir    = TempDirectoriesFactory.CreateEmpty();
     cfgPath    = Path.Combine(tempDir.AbsolutePath, "config.cfg");
     cfgUsrPath = Path.Combine(tempDir.AbsolutePath, "config.cfg.usr");
 }
Пример #15
0
 public void Setup()
 {
     dir = TempDirectoriesFactory.CreateEmpty();
     sqLiteDataStorage = new SqLiteDataStorage(dir.FullName);
 }
Пример #16
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"));
 }
Пример #18
0
 public virtual void Setup()
 {
     dir = TempDirectoriesFactory.CreateEmpty();
 }
Пример #19
0
 public void AutoCleanupsOnAppDomainExit()
 {
     TempDirectoriesFactory.CreateEmpty();
     // dir should not be there after testing finishes and finalizers run on manager
 }
Пример #20
0
 public void Setup()
 {
     dir = TempDirectoriesFactory.CreateEmpty();
     flatFilesDataStorage = new FlatFilesDataStorage(dir.FullName);
 }