Пример #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);
        }
Пример #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")));
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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();
        }
Пример #9
0
            private void ComputeTestRow(Person person)
            {
                var row = new RowTestClass(person, this.Session);

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

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

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