コード例 #1
0
    public void TestMergerReturnsDefaultSourceForNilInput()
    {
      var defaultConfig = new SessionConfigPOD();
      defaultConfig.InstanceUrl = "sitecore.net";
      defaultConfig.ItemWebApiVersion = "v1";
      defaultConfig.Site = "/sitecore/shell";


      var merger = new SessionConfigMerger(defaultConfig);
      ISessionConfig result = merger.FillSessionConfigGaps(null);

      Assert.AreSame(defaultConfig, result);
    }
コード例 #2
0
    public void TestUserFieldsHaveHigherPriority()
    {
      var defaultConfig = new SessionConfigPOD();
      defaultConfig.InstanceUrl = "sitecore.net";
      defaultConfig.ItemWebApiVersion = "v1";
      defaultConfig.Site = "/sitecore/shell";

      var userConfig = new SessionConfigPOD();
      userConfig.InstanceUrl = "http://localhost:80";
      userConfig.ItemWebApiVersion = "v100500";
      userConfig.Site = "/abra/kadabra";

      var merger = new SessionConfigMerger(defaultConfig);
      ISessionConfig result = merger.FillSessionConfigGaps(userConfig);

      Assert.AreEqual(userConfig, result);
      Assert.AreNotSame(userConfig, result);
    }
コード例 #3
0
    public void TestNullUserFieldsAreAutocompleted()
    {
      var defaultConfig = new SessionConfigPOD();
      defaultConfig.InstanceUrl = "sitecore.net";
      defaultConfig.ItemWebApiVersion = "v1";
      defaultConfig.Site = "/sitecore/shell";

      var userConfig = new SessionConfigPOD();
      userConfig.InstanceUrl = null;
      userConfig.ItemWebApiVersion = null;
      userConfig.Site = null;

      var merger = new SessionConfigMerger(defaultConfig);
      ISessionConfig result = merger.FillSessionConfigGaps(userConfig);

      Assert.AreEqual(defaultConfig, result);
      Assert.AreNotSame(defaultConfig, result);
    }