SaveConfiguration() public méthode

Persists the specified T:Stumps.Server.Data.ConfigurationEntity to the data store.
is null.
public SaveConfiguration ( ConfigurationEntity value ) : void
value ConfigurationEntity The to persist in the store.
Résultat void
        public void SaveConfiguration_WithValidEntity_CreateExpectedFile()
        {
            var tempFile = Path.GetTempFileName();

            try
            {
                var dal = new ConfigurationDataAccess(tempFile);
                var entity = new ConfigurationEntity
                {
                    DataCompatibilityVersion = 100,
                    StoragePath = "C:\\SomeValue\\",
                    WebApiPort = 8000
                };

                dal.SaveConfiguration(entity);

                var savedText = File.ReadAllText(tempFile);

                StringAssert.AreEqualIgnoringCase(TestData.SampleConfiguration, savedText);
            }
            finally
            {
                File.Delete(tempFile);
            }
        }
Exemple #2
0
        public void SaveConfiguration_WithValidEntity_CreateExpectedFile()
        {
            var tempFile = Path.GetTempFileName();

            try
            {
                var dal    = new ConfigurationDataAccess(tempFile);
                var entity = new ConfigurationEntity
                {
                    DataCompatibilityVersion = 100,
                    StoragePath = "C:\\SomeValue\\",
                    WebApiPort  = 8000
                };

                dal.SaveConfiguration(entity);

                var savedText = File.ReadAllText(tempFile);

                StringAssert.AreEqualIgnoringCase(TestData.SampleConfiguration, savedText);
            }
            finally
            {
                File.Delete(tempFile);
            }
        }
        public void SaveConfiguration_WithNullValue_ThrowsException()
        {
            var tempFile = Path.GetTempFileName();

            try
            {
                var dal = new ConfigurationDataAccess(tempFile);

                Assert.That(
                    () => dal.SaveConfiguration(null),
                    Throws.Exception.TypeOf<ArgumentNullException>().With.Property("ParamName").EqualTo("value"));
            }
            finally
            {
                File.Delete(tempFile);
            }
        }
Exemple #4
0
        public void SaveConfiguration_WithNullValue_ThrowsException()
        {
            var tempFile = Path.GetTempFileName();

            try
            {
                var dal = new ConfigurationDataAccess(tempFile);

                Assert.That(
                    () => dal.SaveConfiguration(null),
                    Throws.Exception.TypeOf <ArgumentNullException>().With.Property("ParamName").EqualTo("value"));
            }
            finally
            {
                File.Delete(tempFile);
            }
        }