Пример #1
0
 private static void СompareSettings(ExampleSettings originSettings, ExampleSettings newSettings)
 {
     Assert.Equal(originSettings.Count, newSettings.Count);
     Assert.Equal(originSettings.Value, newSettings.Value);
     Assert.Equal(originSettings.TypeCode, newSettings.TypeCode);
     Assert.Equal(originSettings.Uri.AbsoluteUri, newSettings.Uri.AbsoluteUri);
     Assert.Equal(originSettings.TypeCode, newSettings.TypeCode);
 }
Пример #2
0
        public void SaveSettingsTest()
        {
            //Remove file from old tests
            RemoveFileIfExsist(SettingsPath);
            // Create nwe non-default settings
            var exampleSettings = new ExampleSettings
            {
                Count    = 24,
                Text     = "New example line",
                TypeCode = TypeCode.Boolean,
                Uri      = new Uri("https://stackoverflow.com"),
                Value    = 1.93
            };

            // Set path to file.
            exampleSettings.SetFilePath(SettingsPath);
            // Save settings to file.
            exampleSettings.Save();
            // Load settings
            var loadedSettings = SettingsJson.Load <ExampleSettings>(SettingsPath);

            // Compare
            СompareSettings(exampleSettings, loadedSettings);
        }