Ejemplo n.º 1
0
        public void SynchronizeInventories_empty_empty()
        {
            var v = new ViewTemplate();

            ViewTemplate.UpdateUserViewTemplate(v, new ViewTemplate());
            Assert.IsEmpty(v);
        }
Ejemplo n.º 2
0
        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"));
        }
Ejemplo n.º 3
0
        public void MergeWithEmptyInventory()
        {
            ViewTemplate master = MakeMasterInventory();
            int          count  = master.Count;
            var          empty  = new ViewTemplate();

            ViewTemplate.UpdateUserViewTemplate(master, empty);

            Assert.AreEqual(count, master.Count);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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()));
        }
Ejemplo n.º 6
0
        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"));
        }
Ejemplo n.º 7
0
 public void SynchronizeInventories_nullUserTemplate_throws()
 {
     Assert.Throws <ArgumentNullException>(() => ViewTemplate.UpdateUserViewTemplate(new ViewTemplate(), null));
 }