Example #1
0
        public void VerifyThatPropertiesAreSet()
        {
            var statelist = new PossibleFiniteStateList
            {
                Name      = "name",
                ShortName = "shortname"
            };
            var containerClone = this.iteration.Clone(false);

            var transactionContext = TransactionContextResolver.ResolveContext(this.iteration);
            var transaction        = new ThingTransaction(transactionContext, containerClone);

            var vm = new PossibleFiniteStateListDialogViewModel(statelist, transaction, this.session.Object, true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, containerClone);

            Assert.AreEqual(statelist.Name, vm.Name);
            Assert.AreEqual(statelist.ShortName, vm.ShortName);

            Assert.AreEqual(1, vm.PossibleOwner.Count);
            Assert.AreEqual(1, vm.PossibleCategory.Count);

            Assert.IsFalse(vm.OkCanExecute);

            statelist.PossibleState.Add(new PossibleFiniteState(Guid.NewGuid(), null, null));
            statelist.DefaultState = statelist.PossibleState.First();
            vm = new PossibleFiniteStateListDialogViewModel(statelist, transaction, this.session.Object, true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, containerClone);
            Assert.AreEqual(1, vm.PossibleState.Count);
            Assert.AreEqual(statelist.DefaultState, vm.SelectedDefaultState);
        }
Example #2
0
        public void VerifyThatSetDefaultWorks()
        {
            var statelist = new PossibleFiniteStateList
            {
                Name      = "name",
                ShortName = "shortname"
            };

            var state = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri);

            statelist.PossibleState.Add(state);

            var containerClone = this.iteration.Clone(false);

            var transactionContext = TransactionContextResolver.ResolveContext(this.iteration);
            var transaction        = new ThingTransaction(transactionContext, containerClone);

            var vm = new PossibleFiniteStateListDialogViewModel(statelist, transaction, this.session.Object, true, ThingDialogKind.Create, this.thingDialogNavigationService.Object, containerClone);

            vm.SelectedPossibleState = vm.PossibleState.Single();
            vm.SetDefaultStateCommand.Execute(null);

            Assert.IsTrue(((PossibleFiniteStateRowViewModel)vm.SelectedPossibleState).IsDefault);
            Assert.AreSame(vm.SelectedDefaultState, state);
        }