Exemplo n.º 1
0
        public async Task VerifyThatOkCommandWorksWhenRoot()
        {
            var vm = new DomainOfExpertiseDialogViewModel(this.domain, this.transaction, this.session.Object, true,
                                                          ThingDialogKind.Create, this.navigation.Object, this.clone);

            vm.OkCommand.Execute(null);

            this.session.Verify(x => x.Write(It.IsAny <OperationContainer>()));
            Assert.IsTrue(vm.DialogResult.Value);
        }
Exemplo n.º 2
0
        public async Task VerifyThatOkCommandCatchesException()
        {
            var vm = new DomainOfExpertiseDialogViewModel(this.domain, this.transaction, this.session.Object, true,
                                                          ThingDialogKind.Create, this.navigation.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);
        }
Exemplo n.º 3
0
        public void VerifyThatPropertiesAreSet()
        {
            this.domain.Name      = "test";
            this.domain.ShortName = "test";

            var vm = new DomainOfExpertiseDialogViewModel(this.domain, this.transaction, this.session.Object, true,
                                                          ThingDialogKind.Create, this.navigation.Object, this.clone);

            Assert.AreEqual(this.domain.Name, vm.Name);
            Assert.AreEqual(this.domain.ShortName, vm.ShortName);
            Assert.AreEqual(this.domain.IsDeprecated, vm.IsDeprecated);
        }
Exemplo n.º 4
0
        public async Task VerifyThatOkCommandWorksWhenNotRoot()
        {
            var vm = new DomainOfExpertiseDialogViewModel(this.domain, this.transaction, this.session.Object, false,
                                                          ThingDialogKind.Create, this.navigation.Object, this.clone);

            vm.Name      = "test";
            vm.ShortName = "t";

            vm.OkCommand.Execute(null);

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

            Assert.AreEqual(vm.Name, clone.Name);
            Assert.AreEqual(vm.ShortName, clone.ShortName);
            Assert.AreEqual(vm.IsDeprecated, clone.IsDeprecated);
        }
Exemplo n.º 5
0
        public void VerifyThatDefaultConstructorDoesNotThrowException()
        {
            var domainOfExpertiseDialogViewModel = new DomainOfExpertiseDialogViewModel();

            Assert.IsNotNull(domainOfExpertiseDialogViewModel);
        }