Beispiel #1
0
        public void VerifyThatIdataErrorValidationWorks()
        {
            var row = new RowTestClass(this.person, this.session.Object);

            row.ShortName = "a";
            Assert.That(row["ShortName"], Is.Null.Or.Empty);
        }
Beispiel #2
0
        public void VerifyCreateCloneAndWriteWorks()
        {
            var row = new RowTestClass(this.person, this.session.Object);

            row.CreateCloneAndWrite("abc", "ShortName");

            this.session.Verify(x => x.Write(It.Is <OperationContainer>(op => ((CDP4Common.DTO.Person)op.Operations.Single().ModifiedThing).ShortName == "abc")));
        }
Beispiel #3
0
        public void VerifyThatValidatePropertyWorks()
        {
            var row = new RowTestClass(this.person, this.session.Object);

            row.ShortName = "a";
            Assert.That(row.ValidateProperty("ShortName", "a"), Is.Null.Or.Empty);

            Assert.That(row.ValidateProperty("ShortName", "---"), Is.Not.Null.Or.Not.Empty);
        }
Beispiel #4
0
        public void VerifyThatUpdateHightlightMsgIsCaughtForDirectMessageBusSubscription()
        {
            var row = new RowTestClass(this.person, this.session.Object);

            Assert.IsFalse(row.IsHighlighted);

            CDPMessageBus.Current.SendMessage(new HighlightEvent(this.person), this.person);
            Assert.IsTrue(row.IsHighlighted);
        }
Beispiel #5
0
        public void VerifyThatComputeGenericRowWork()
        {
            var row = new RowTestClass(this.person, this.session.Object);

            row.ComputeRow(new List <Person> {
                this.person
            });
            Assert.AreEqual(1, row.ContainedRows.Count);

            row.ComputeRow(new List <Person>());
            Assert.AreEqual(0, row.ContainedRows.Count);
        }
Beispiel #6
0
        public void VerifyThatUpdateHighlightMsgIsCaughtForMessageBusHandler()
        {
            var containerViewModel = new TestMessageBusHandlerContainerViewModel();
            var row = new RowTestClass(this.person, this.session.Object, containerViewModel);

            Assert.IsFalse(row.IsHighlighted);

            CDPMessageBus.Current.SendMessage(new HighlightEvent(this.person), this.person);
            Assert.IsFalse(row.IsHighlighted);

            CDPMessageBus.Current.SendMessage(new HighlightEvent(this.person), null);
            Assert.IsTrue(row.IsHighlighted);
        }
Beispiel #7
0
        public void VerifyThatUpdatePersonMsgIsCaught()
        {
            var row = new RowTestClass(this.person, this.session.Object);

            Assert.IsTrue(row.isUpdatePropertyCalled);

            row.isUpdatePropertyCalled = false;

            var rev = typeof(Thing).GetProperty("RevisionNumber");

            rev.SetValue(this.person, 50);

            CDPMessageBus.Current.SendObjectChangeEvent(this.person, EventKind.Updated);
            Assert.IsTrue(row.isUpdatePropertyCalled);
        }
Beispiel #8
0
        public void VerifyThatUpdatePropertyIsCalledOnDalError()
        {
            this.session.Setup(x => x.Write(It.IsAny <OperationContainer>())).Throws(new Exception("test"));
            var row = new RowTestClass(this.person, this.session.Object);

            row.isUpdatePropertyCalled = false;
            row.CreateCloneAndWrite("abc", "ShortName");

            Assert.IsTrue(row.HasError);
            Assert.That(row.ErrorMsg, Is.Not.Null.Or.Not.Empty);

            Assert.IsTrue(row.isUpdatePropertyCalled);

            row.Dispose();
        }
Beispiel #9
0
            private void ComputeTestRow(Person person)
            {
                var row = new RowTestClass(person, this.Session);

                this.ContainedRows.Add(row);
            }
Beispiel #10
0
        public void VerifyThatRowTypeIsCorrect()
        {
            var row = new RowTestClass(this.person, this.session.Object);

            Assert.AreEqual("Person", row.RowType);
        }
Beispiel #11
0
        public void VerifyThatCreateCloneThrows()
        {
            var row = new RowTestClass(this.person, this.session.Object);

            Assert.Throws <InvalidOperationException>(() => row.CreateCloneAndWrite("abc", "Exception"));
        }