Esempio n. 1
0
    public void ShouldReturnEmptyStringByDefault(string xml)
    {
      // arrange
      var config = new XmlDocument();
      config.LoadXml(xml);

      // act
      var settings = new Settings(config);

      // assert
      settings["MySetting"].Should().BeEmpty();
    }
Esempio n. 2
0
    public void ShouldReadSettingsFromSitecoreSection()
    {
      // arrange
      var config = new XmlDocument();
      config.LoadXml("<sitecore><settings><setting name=\"MySetting\" value=\"MyValue\" /></settings></sitecore>");

      // act
      var settings = new Settings(config);

      // assert
      settings["MySetting"].Should().Be("MyValue");
    }
Esempio n. 3
0
    public void ShouldSetSetting(string xml)
    {
      // arrange
      var config = new XmlDocument();
      config.LoadXml(xml);

      // act
      var settings = new Settings(config);
      settings["MySetting"] = "MyNewValue";

      // assert
      config.OuterXml.Should().Be("<sitecore><settings><setting name=\"MySetting\" value=\"MyNewValue\" /></settings></sitecore>");
    }
Esempio n. 4
0
    public void ShouldAddNewSettingsInSitecoreSection()
    {
      // arrange
      var config = new XmlDocument();
      config.LoadXml("<sitecore><settings></settings></sitecore>");

      // act
      var settings = new Settings(config);
      settings["MySetting"] = "MyValue";

      // assert
      config.OuterXml.Should().Be("<sitecore><settings><setting name=\"MySetting\" value=\"MyValue\" /></settings></sitecore>");
    }
 public DbConfiguration(XmlDocument config)
 {
   this.settings = new Settings(config);
 }