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 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(); }
public void VerifyThatCreateCloneThrows() { var row = new RowTestClass(this.person, this.session.Object); Assert.Throws <InvalidOperationException>(() => row.CreateCloneAndWrite("abc", "Exception")); }