Beispiel #1
0
        public void VerifyThatConvertingNonParameterOrOverrideBaseReturnsNull()
        {
            var naturalLanguage = new NaturalLanguage();
            var converterResult = (BitmapImage)this.converter.Convert(new object[] { naturalLanguage }, null, null, null);

            Assert.IsNull(converterResult);

            var naturalLanguageRow = new NaturalLanguageRowViewModel(naturalLanguage, this.session.Object, null);
            var converterResult2   = (BitmapImage)this.converter.Convert(new object[] { naturalLanguageRow }, null, null, null);

            Assert.IsNull(converterResult2);
        }
Beispiel #2
0
        public void SetUp()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;
            this.session                      = new Mock <ISession>();
            this.permissionService            = new Mock <IPermissionService>();
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();

            this.naturalLanguage = new NaturalLanguage(Guid.NewGuid(), null, null)
            {
                LanguageCode = this.languageCode, NativeName = this.nativeName, Name = this.name
            };
            this.viewModel = new NaturalLanguageRowViewModel(this.naturalLanguage, this.session.Object, null);
        }
        public void VerifyThatPropertiesAreSet()
        {
            var language = new NaturalLanguage(Guid.NewGuid(), null, new Uri("http://test.com"));

            language.Name         = "Test";
            language.LanguageCode = "t";
            language.NativeName   = "Testa";

            var row = new NaturalLanguageRowViewModel(language, this.session.Object, null);

            Assert.AreEqual(language.Name, row.Name);
            Assert.AreEqual(language.LanguageCode, row.LanguageCode);
            Assert.AreEqual(language.NativeName, row.NativeName);

            language.Name = "update";
            // workaround to modify a read-only field
            var type = language.GetType();

            type.GetProperty("RevisionNumber").SetValue(language, 50);
            CDPMessageBus.Current.SendObjectChangeEvent(language, EventKind.Updated);

            Assert.AreEqual(language.Name, row.Name);
        }
Beispiel #4
0
        /// <summary>
        /// Adds a <see cref="NaturalLanguageRowViewModel"/>
        /// </summary>
        /// <param name="naturalLanguage">The associated <see cref="NaturalLanguage"/></param>
        private void AddNaturalLanguageRowViewModel(NaturalLanguage naturalLanguage)
        {
            var row = new NaturalLanguageRowViewModel(naturalLanguage, this.Session, this);

            this.NaturalLanguageRowViewModels.Add(row);
        }