Ejemplo n.º 1
0
        public void RoundtripRepositorySettings()
        {
            var backupSettings = new BackupSettings(BackupDir.FullName, ".abc", BackupSettings.DefaultTimeStampFormat, 2, 3);
            var settings       = new Core.RepositorySettings(
                directory: Directory.FullName,
                isTrackingDirty: false,
                backupSettings: backupSettings,
                extension: ".cde",
                tempExtension: ".fgh");
            var json         = JsonConvert.SerializeObject(settings);
            var roundtripped = JsonConvert.DeserializeObject <Core.RepositorySettings>(json);

            AssertProperties(settings, roundtripped);
            Assert.IsTrue(JsonEqualsComparer <Core.RepositorySettings> .Default.Equals(settings, roundtripped));
        }
Ejemplo n.º 2
0
        public void RoundtripRepositorySettingsWithRepository()
        {
            var backupSettings = new BackupSettings(BackupDir.FullName, ".abc", BackupSettings.DefaultTimeStampFormat, 2, 3);
            var settings       = new Core.RepositorySettings(
                directory: Directory.FullName,
                isTrackingDirty: false,
                backupSettings: backupSettings,
                extension: ".cde",
                tempExtension: ".fgh");
            var repository = new DataRepository(DataRepositorySettings);

            repository.Save(settings);
            var roundtripped = repository.Read <Core.RepositorySettings>();

            AssertProperties(settings, roundtripped);
            Assert.IsTrue(JsonEqualsComparer <Core.RepositorySettings> .Default.Equals(settings, roundtripped));
        }
Ejemplo n.º 3
0
        public void CreateFromRepositorySettingsAndJsonSettings()
        {
            var backupSettings     = new BackupSettings(BackupDir.FullName, ".abc", BackupSettings.DefaultTimeStampFormat, 2, 3);
            var repositorySettings = new Core.RepositorySettings(
                directory: Directory.FullName,
                isTrackingDirty: false,
                backupSettings: backupSettings,
                extension: ".cde",
                tempExtension: ".fgh");
            var created = new SingletonRepository(repositorySettings, RepositorySettings.CreateDefaultJsonSettings());

            var jsonRepositorySettings = new RepositorySettings(
                directory: Directory.FullName,
                jsonSerializerSettings: RepositorySettings.CreateDefaultJsonSettings(),
                isTrackingDirty: false,
                backupSettings: backupSettings,
                extension: ".cde",
                tempExtension: ".fgh");

            AssertProperties(jsonRepositorySettings, created.Settings);
            Assert.IsTrue(JsonEqualsComparer <RepositorySettings> .Default.Equals(jsonRepositorySettings, created.Settings));
        }