public void TestMergerReturnsNullIfBothInputAndDefaultAreNull()
    {
      var merger = new ItemSourceFieldMerger(null);
      IItemSource result = merger.FillItemSourceGaps(null);

      Assert.IsNull(result);
    }
    public void TestItemSourceMergerCopiesInputStruct()
    {
      IItemSource source = new ItemSourcePOD("master", "da", 100500 );
      var merger = new ItemSourceFieldMerger(source);

      Assert.AreNotSame(source, merger.DefaultSource);
      Assert.AreEqual(source, merger.DefaultSource);
    }
    public void TestMergerReturnsInputSourceCopyForNilDefault()
    {
      ItemSource defaultSource = LegacyConstants.DefaultSource();

      var merger = new ItemSourceFieldMerger(null);
      IItemSource result = merger.FillItemSourceGaps(defaultSource);

      Assert.AreNotSame(defaultSource, result);
      Assert.AreEqual(defaultSource, result);
    }
    public void TestUserFieldsHaveHigherPriority()
    {
      var defaultSource = new ItemSourcePOD ("master", "en", 1);
      var userSource = new ItemSourcePOD ("web", "ua", 42);

      var merger = new ItemSourceFieldMerger (defaultSource);
      IItemSource result = merger.FillItemSourceGaps (userSource);

      Assert.AreEqual (userSource, result);
      Assert.AreNotSame (userSource, result);
    }
    public void TestNullUserFieldsAreAutocompleted()
    {
      var defaultSource = new ItemSourcePOD ("master", "en", 1);
      var userSource = new ItemSourcePOD (null, null, null);

      var merger = new ItemSourceFieldMerger (defaultSource);
      IItemSource result = merger.FillItemSourceGaps (userSource);

      Assert.AreEqual (defaultSource, result);
      Assert.AreNotSame (defaultSource, result);
    }
 public void TestItemSourceMergerDefaultValuesAreOptional()
 {
   var result = new ItemSourceFieldMerger(null);
   Assert.IsNotNull(result);
 }