Example #1
0
        public void VerifyThatErrorIsThrownWhenThingContainsInCorrectStringValueAfterUpdateTransactionWasCalled()
        {
            var vm = new CultureConversionRelationalExpressionDialogViewModel(this.dateRelationalExpression, this.thingTransaction,
                                                                              this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.clone);

            vm.Value[0].Value = "Throw error";
            Assert.Throws <Cdp4ModelValidationException>(() => vm.RunUpdateTransaction());

            vm.Value[0].Value = "-";
            Assert.Throws <Cdp4ModelValidationException>(() => vm.RunUpdateTransaction());

            vm.Value[0].Value = null;
            Assert.DoesNotThrow(() => vm.RunUpdateTransaction());
        }
Example #2
0
        public void VerifyThatThingContainsCorrectStringValueAfterUpdateTransactionWasCalled()
        {
            var vm = new CultureConversionRelationalExpressionDialogViewModel(this.dateRelationalExpression, this.thingTransaction,
                                                                              this.session.Object, true, ThingDialogKind.Update, this.thingDialogNavigationService.Object, this.clone);

            var newValue       = new DateTime(2020, 1, 1).ToString("MM/dd/yyyy hh:mm:ss");
            var convertedValue = new DateTime(2020, 1, 1).ToString("yyyy-MM-dd");

            //This is what happens when set value from UI is done
            vm.Value[0].Value = newValue;

            vm.RunUpdateTransaction();

            Assert.AreEqual(convertedValue, this.dateRelationalExpression.Value[0]);
        }