Пример #1
0
        public void AlwaysSerialize_WithUnchangedProperty_SerializesPropertyAnyway()
        {
            // Arrange
            var secondary = new Config
                {
                    Age = 12,
                    Name = "Timothy"
                };

            var primary = new Config();

            var expected = new Config
                {
                    Name = "Timothy"
                };

            var configManager = new ConfigurationManager<Config>(
                new DummyConfigurationSource<Config>(secondary),
                new DummyConfigurationSource<Config>(primary));

            configManager.AlwaysSerialize(t => t.Name);

            var actualManager = new DummyConfigurationSource<Config>(new Config());
            configManager.SaveChanges(actualManager);

            Assert.IsTrue(new ConfigComparer().Equals(
                expected, actualManager.SavedObject));
        }
Пример #2
0
        public void AlwaysSerialize_WithUnchangedProperty_SerializesPropertyAnyway()
        {
            // Arrange
            var secondary = new Config
            {
                Age  = 12,
                Name = "Timothy"
            };

            var primary = new Config();

            var expected = new Config
            {
                Name = "Timothy"
            };

            var configManager = new ConfigurationManager <Config>(
                new DummyConfigurationSource <Config>(secondary),
                new DummyConfigurationSource <Config>(primary));

            configManager.AlwaysSerialize(t => t.Name);

            var actualManager = new DummyConfigurationSource <Config>(new Config());

            configManager.SaveChanges(actualManager);

            Assert.IsTrue(new ConfigComparer().Equals(
                              expected, actualManager.SavedObject));
        }