Exemplo n.º 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);
        }
Exemplo n.º 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")));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 9
0
            private void ComputeTestRow(Person person)
            {
                var row = new RowTestClass(person, this.Session);

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

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

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