コード例 #1
0
        public void ShouldReturnCorrectConfig()
        {
            // Arrange
            var testConfig = new TestConfig();

            // System under Test
            var configSerializer = new ConfigSerializer();

            // Act
            configSerializer.SetDeserializedConfigs(XDocument.Parse(CONFIG_XML), new IConfigSection[] { testConfig });

            // Assert
            Assert.AreEqual("6fa5a650-25f3-4c86-a515-37e3163a54e9", testConfig.TestVar1);
        }
コード例 #2
0
        public void ShouldReturnCorrectXml()
        {
            // Arrange
            var testConfig = new TestConfig { TestVar1 = "6fa5a650-25f3-4c86-a515-37e3163a54e9" };

            // System under Test
            var configSerializer = new ConfigSerializer();

            // Act
            var xmlDocument = configSerializer.GetSerializedConfigs(new IConfigSection[] { testConfig });

            // Assert
            Assert.AreEqual(CONFIG_XML.Replace(" ", ""), xmlDocument.ToString().Replace("\r\n", "").Replace(" ", ""));
        }
コード例 #3
0
        public void ShouldExecutePropertyChanged()
        {
            // Arrange
            var testConfig = new TestConfig();
            var wasRaised = false;

            // System under Test
            var configController = new ConfigController(new IConfigSection[] { testConfig }, new SharpDoxConfig(new SharpDoxStrings()));
            testConfig.PropertyChanged += (a, s) => { wasRaised = true; };

            // Act
            testConfig.TestVar1 = "6fa5a650-25f3-4c86-a515-37e3163a54e9";

            // Assert
            Assert.IsTrue(wasRaised);
        }