Beispiel #1
0
        public void VerifyThatCreateComponentWork()
        {
            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction        = new ThingTransaction(transactionContext);

            var viewmodel = new CompoundParameterTypeDialogViewModel(this.compoundPt, transaction, this.session.Object, true, ThingDialogKind.Create, null, null);

            Assert.IsEmpty(viewmodel.Component);
            viewmodel.CreateComponentCommand.Execute(null);
            Assert.AreEqual(1, viewmodel.Component.Count);

            Assert.IsFalse(viewmodel.OkCommand.CanExecute(null));

            var componentRow = (ParameterTypeComponentRowViewModel)viewmodel.Component.Single();

            componentRow.ParameterType = componentRow.PossibleParameterType.First();

            Assert.IsFalse(viewmodel.OkCommand.CanExecute(null));
            viewmodel.Component.First().ShortName = "FirstComponent";
            Assert.IsTrue(viewmodel.OkCommand.CanExecute(null));
            viewmodel.CreateComponentCommand.Execute(null);
            viewmodel.Component.Last().ShortName = "SecondComponent";
            Assert.AreEqual(2, viewmodel.Component.Count);

            Assert.IsFalse(viewmodel.OkCommand.CanExecute(null));
            var c2Row = (ParameterTypeComponentRowViewModel)viewmodel.Component.Last();

            c2Row.ParameterType = c2Row.PossibleParameterType.Single(x => x is SimpleQuantityKind);

            Assert.IsNotNull(c2Row.Scale);
            Assert.IsTrue(viewmodel.OkCommand.CanExecute(null));
        }
Beispiel #2
0
        public void VerifyThatPossibleParameterTypesArePopulatedCorrectly()
        {
            var transactionContext     = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction            = new ThingTransaction(transactionContext);
            var viewmodel              = new CompoundParameterTypeDialogViewModel(this.compoundPt, transaction, this.session.Object, true, ThingDialogKind.Create, null);
            var parameterTypeComponent = new ParameterTypeComponentRowViewModel(this.parameterType, this.session.Object, viewmodel);

            Assert.True(parameterTypeComponent.PossibleParameterType.Count.Equals(2));
        }
Beispiel #3
0
        public void VerifyThatFilterSelectsCorrectPossibleParameterType()
        {
            var transactionContext     = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction            = new ThingTransaction(transactionContext);
            var viewmodel              = new CompoundParameterTypeDialogViewModel(this.compoundPt, transaction, this.session.Object, true, ThingDialogKind.Create, null);
            var parameterTypeComponent = new ParameterTypeComponentRowViewModel(this.parameterType, this.session.Object, viewmodel);

            parameterTypeComponent.SelectedFilter = typeof(SimpleQuantityKind).Name;
            Assert.True(parameterTypeComponent.PossibleParameterType[0] is SimpleQuantityKind);
        }
Beispiel #4
0
        public void VerifyThatPropertiesAreSet()
        {
            var transactionContext     = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction            = new ThingTransaction(transactionContext);
            var viewmodel              = new CompoundParameterTypeDialogViewModel(this.compoundPt, transaction, this.session.Object, true, ThingDialogKind.Create, null);
            var parameterTypeComponent = new ParameterTypeComponentRowViewModel(this.parameterType, this.session.Object, viewmodel);

            Assert.False(parameterTypeComponent.IsReadOnly);
            Assert.Null(parameterTypeComponent.SelectedFilter);
            Assert.Null(parameterTypeComponent.Coordinates);
            Assert.AreEqual(parameterTypeComponent.PossibleParameterType.Count, 2);
            Assert.AreEqual(parameterTypeComponent.PossibleScale.Count, 0);
        }
Beispiel #5
0
        public void VerifyThatPropertiesAreSet()
        {
            var transactionContext = TransactionContextResolver.ResolveContext(this.siteDir);
            var transaction        = new ThingTransaction(transactionContext);
            var viewmodel          = new CompoundParameterTypeDialogViewModel(this.compoundPt, transaction, this.session.Object, true, ThingDialogKind.Create, null);

            Assert.AreEqual(viewmodel.Name, this.compoundPt.Name);
            Assert.AreEqual(viewmodel.ShortName, this.compoundPt.ShortName);
            Assert.AreEqual(viewmodel.IsDeprecated, this.compoundPt.IsDeprecated);
            Assert.AreEqual(viewmodel.Symbol, this.compoundPt.Symbol);
            Assert.IsNotEmpty(viewmodel.PossibleContainer);
            Assert.IsNotEmpty(viewmodel.PossibleCategory);
            Assert.AreEqual(2, viewmodel.PossibleParameterType.Count);
        }