public void SynchronizeInventories_empty_empty() { var v = new ViewTemplate(); ViewTemplate.UpdateUserViewTemplate(v, new ViewTemplate()); Assert.IsEmpty(v); }
public void CustomFieldRetained() { ViewTemplate master = MakeMasterInventory(); int count = master.Count; var usersTemplate = new ViewTemplate(); usersTemplate.Add(new Field("dummy", "LexEntry", new[] { "en" })); ViewTemplate.UpdateUserViewTemplate(master, usersTemplate); Assert.IsTrue(usersTemplate.Contains("dummy")); }
public void MergeWithEmptyInventory() { ViewTemplate master = MakeMasterInventory(); int count = master.Count; var empty = new ViewTemplate(); ViewTemplate.UpdateUserViewTemplate(master, empty); Assert.AreEqual(count, master.Count); }
public void UpdateUserViewTemplate_Jan2008Upgrade_DefinitionIsEnabled() { ViewTemplate master = MakeMasterInventory(); var simple = new ViewTemplate(); var definitionField = new Field(LexSense.WellKnownProperties.Definition, "LexSense", new[] { "en" }); definitionField.Enabled = false; simple.Add(definitionField); ViewTemplate.UpdateUserViewTemplate(master, simple); Assert.IsTrue(definitionField.Enabled); }
public void UserInvWithVisibleFieldConveyedToMaster() { ViewTemplate master = MakeMasterInventory(); Assert.IsFalse(master.Contains(Field.FieldNames.ExampleTranslation.ToString()), "If translation is turned on by default, you must fix the test which sees if it is turned on by the user inventory"); int count = master.Count; var simple = new ViewTemplate(); simple.Add(new Field(Field.FieldNames.ExampleTranslation.ToString(), "LexExampleSentence", new[] { "en" })); ViewTemplate.UpdateUserViewTemplate(master, simple); Assert.AreEqual(count, master.Count); Assert.IsTrue(master.Contains(Field.FieldNames.ExampleTranslation.ToString())); }
public void UpdateUserViewTemplate_Jan2008Upgrade_DefinitionGetsGlossWritingSystemsAdded() { ViewTemplate master = MakeMasterInventory(); ViewTemplate simple = new ViewTemplate(); Field definitionField = new Field(LexSense.WellKnownProperties.Definition, "LexSense", new[] { "en", "a", "b" }); definitionField.Enabled = false; simple.Add(definitionField); Field glossField = new Field(LexSense.WellKnownProperties.Gloss, "LexSense", new[] { "b", "c" }); simple.Add(glossField); ViewTemplate.UpdateUserViewTemplate(master, simple); Assert.AreEqual(4, definitionField.WritingSystemIds.Count); Assert.IsTrue(definitionField.WritingSystemIds.Contains("en")); Assert.IsTrue(definitionField.WritingSystemIds.Contains("a")); Assert.IsTrue(definitionField.WritingSystemIds.Contains("b")); Assert.IsTrue(definitionField.WritingSystemIds.Contains("c")); }
public void SynchronizeInventories_nullUserTemplate_throws() { Assert.Throws <ArgumentNullException>(() => ViewTemplate.UpdateUserViewTemplate(new ViewTemplate(), null)); }