public void VerifyThatIdataErrorValidationWorks() { var row = new RowTestClass(this.person, this.session.Object); row.ShortName = "a"; Assert.That(row["ShortName"], Is.Null.Or.Empty); }
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"))); }
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); }
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); }
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); }
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); }
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); }
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(); }
private void ComputeTestRow(Person person) { var row = new RowTestClass(person, this.Session); this.ContainedRows.Add(row); }
public void VerifyThatRowTypeIsCorrect() { var row = new RowTestClass(this.person, this.session.Object); Assert.AreEqual("Person", row.RowType); }
public void VerifyThatCreateCloneThrows() { var row = new RowTestClass(this.person, this.session.Object); Assert.Throws <InvalidOperationException>(() => row.CreateCloneAndWrite("abc", "Exception")); }