// ReSharper disable InconsistentNaming public void DsfDatabaseActivity_UnitTest_ExecutionImpl_InvokesDatabaseServiceExecution() // ReSharper restore InconsistentNaming { // ReSharper disable RedundantAssignment ErrorResultTO errors = new ErrorResultTO(); // ReSharper restore RedundantAssignment var dataObj = new Mock <IDSFDataObject>(); var dbServiceExecution = new Mock <IServiceExecution>(); dbServiceExecution.Setup(s => s.DataObj).Returns(dataObj.Object); dbServiceExecution.Setup(s => s.Execute(out errors)).Verifiable(); var databaseActivity = new MockDsfDatabaseActivity(dbServiceExecution.Object); // ShapeForSubRequest var mockEsb = new Mock <IEsbChannel>(); //mockEsb.Setup(s => s.ShapeForSubRequest(It.IsAny<IDSFDataObject>(), It.IsAny<string>(), It.IsAny<string>(), out errors)).Returns(null); databaseActivity.MockExecutionImpl(mockEsb.Object, dataObj.Object, string.Empty, string.Empty, out errors); //assert dbServiceExecution.Verify(s => s.Execute(out errors)); }
// ReSharper disable InconsistentNaming public void DsfDatabaseActivity_UnitTest_BeforeExecutionStart_CreatesServiceExecutionAndInvokesServiceExecutionBeforeExecution() // ReSharper restore InconsistentNaming { //init var databaseActivity = new MockDsfDatabaseActivity(); var dataObj = new Mock <IDSFDataObject>(); //exe databaseActivity.MockBeforeExecutionStart(dataObj.Object); //assert Assert.IsNotNull(databaseActivity.ServiceExecution, "DsfDatabaseActivity did not construct a correct DatabaseServiceExecution."); Assert.AreSame(dataObj.Object, databaseActivity.ServiceExecution.DataObj, "Data Object not assigned to DatabaseServiceExecution."); }
// ReSharper disable InconsistentNaming public void DsfDatabaseActivity_UnitTest_AfterExecutionCompleted_InvokesServiceExecutionAfterExecution() // ReSharper restore InconsistentNaming { var dataObj = new Mock <IDSFDataObject>(); var dbServiceExecution = new Mock <IServiceExecution>(); dbServiceExecution.Setup(s => s.DataObj).Returns(dataObj.Object); dbServiceExecution.Setup(s => s.AfterExecution(It.IsAny <ErrorResultTO>())).Verifiable(); var databaseActivity = new MockDsfDatabaseActivity(dbServiceExecution.Object); databaseActivity.MockAfterExecutionCompleted(); //assert dbServiceExecution.Verify(s => s.AfterExecution(It.IsAny <ErrorResultTO>())); }