Beispiel #1
0
        public void Save_SetsModelContents()
        {
            var testConfig = new DictionaryHomographConfiguration
            {
                HomographNumberBefore = true,
                ShowHwNumInCrossRef   = false,
                ShowSenseNumber       = false,
            };
            var view = new TestHeadwordNumbersView {
                HomographBefore = false, ShowHomograph = true, ShowSenseNumber = true
            };
            var model = new DictionaryConfigurationModel {
                HomographConfiguration = testConfig
            };
            // ReSharper disable once UnusedVariable
            var testController = new HeadwordNumbersController(view, model, Cache);

            view.Show();
            view.HomographBefore         = false;
            view.ShowHomographOnCrossRef = true;
            view.ShowSenseNumber         = true;
            // SUT
            testController.Save();
            // Verify save in Dictionary Config
            Assert.IsFalse(model.HomographConfiguration.HomographNumberBefore);
            Assert.IsTrue(model.HomographConfiguration.ShowHwNumInCrossRef);
            Assert.IsTrue(model.HomographConfiguration.ShowSenseNumber);
        }
Beispiel #2
0
        public void SetsViewDataFromDefaultsIfNoHomographConfigurationInConfigurationModel()
        {
            var hc   = new HomographConfiguration();
            var view = new TestHeadwordNumbersView
            {
                HomographBefore = !hc.HomographNumberBefore,
                ShowHomograph   = !hc.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef),
                ShowSenseNumber = !hc.ShowSenseNumberRef
            };
            var model = new DictionaryConfigurationModel();
            // ReSharper disable once UnusedVariable
            var testController = new HeadwordNumbersController(view, model, Cache);

            view.Show();
            Assert.AreEqual(view.HomographBefore, hc.HomographNumberBefore);
            Assert.AreEqual(view.ShowHomographOnCrossRef, hc.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef));
            Assert.AreEqual(view.ShowSenseNumber, hc.ShowSenseNumberRef);
        }
Beispiel #3
0
        public void ViewReflectsModelContents_Reversal()
        {
            var testConfig = new DictionaryHomographConfiguration
            {
                HomographNumberBefore       = true,
                ShowHwNumInReversalCrossRef = false,
                ShowSenseNumberReversal     = false
            };
            var view  = new TestHeadwordNumbersView();
            var model = new DictionaryConfigurationModel {
                WritingSystem = "en", HomographConfiguration = testConfig
            };
            // ReSharper disable once UnusedVariable
            var testController = new HeadwordNumbersController(view, model, Cache);

            view.Show();
            Assert.IsTrue(view.HomographBefore);
            Assert.IsFalse(view.ShowHomographOnCrossRef);
            Assert.IsFalse(view.ShowSenseNumber);
        }