public async Task VerifyThatOkCommandWorksWhenRoot()
        {
            var vm = new NaturalLanguageDialogViewModel(this.naturalLanguage, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, this.clone);

            vm.OkCommand.Execute(null);

            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()));
            Assert.IsTrue(vm.DialogResult.Value);
        }
        public async Task VerifyThatOkCommandCatchesException()
        {
            var vm = new NaturalLanguageDialogViewModel(this.naturalLanguage, this.transaction, this.session.Object, true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, this.clone);

            this.session.Setup(x => x.Write(It.IsAny <OperationContainer>())).Throws(new Exception("test"));

            vm.OkCommand.Execute(null);
            Assert.IsNotNull(vm.WriteException);
            Assert.IsNull(vm.DialogResult);
        }
        public void VerifyThatPropertiesAreSet()
        {
            this.naturalLanguage.Name         = "languagecode";
            this.naturalLanguage.LanguageCode = "lc";
            this.naturalLanguage.NativeName   = "nativename";

            var vm = new NaturalLanguageDialogViewModel(this.naturalLanguage, this.transaction, this.session.Object, true, ThingDialogKind.Inspect, this.thingDialogNavigationService.Object, this.clone);

            Assert.AreEqual(this.naturalLanguage.Name, vm.Name);
            Assert.AreEqual(this.naturalLanguage.LanguageCode, vm.LanguageCode);
            Assert.AreEqual(this.naturalLanguage.NativeName, vm.NativeName);
        }
        public async Task VerifyThatOkCommandWorksWhenNotRoot()
        {
            var vm = new NaturalLanguageDialogViewModel(this.naturalLanguage, this.transaction, this.session.Object, false, ThingDialogKind.Create, this.thingDialogNavigationService.Object, this.clone);

            vm.Name         = "test";
            vm.LanguageCode = "t";
            vm.NativeName   = "tt";

            vm.OkCommand.Execute(null);

            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()), Times.Never());
            var clone = (NaturalLanguage)this.transaction.AddedThing.Single();

            Assert.AreEqual(vm.Name, clone.Name);
            Assert.AreEqual(vm.LanguageCode, clone.LanguageCode);
            Assert.AreEqual(vm.NativeName, clone.NativeName);
        }
        public void VerifyThatDefaultConstructorDoesNotThrowException()
        {
            var naturalLanguageDialogViewModel = new NaturalLanguageDialogViewModel();

            Assert.IsNotNull(naturalLanguageDialogViewModel);
        }