Ejemplo n.º 1
0
        public void ExecuteTool_GivenNoToPath_ShouldAddError()
        {
            //---------------Set up test pack-------------------
            var mockExecutor  = new Mock <IDropboxSingleExecutor <IDropboxResult> >();
            var clientWrapper = new Mock <IDropboxClientWrapper>();

            mockExecutor.Setup(executor => executor.ExecuteTask(TestConstant.DropboxClientInstance.Value))
            .Returns(new DropboxUploadSuccessResult(TestConstant.FileMetadataInstance.Value));
            var dsfDropBoxUploadAcivtityMock = new DsfDropBoxUploadActivityMock(mockExecutor.Object, clientWrapper.Object)
            {
                IsUplodValidSuccess = true
            };

            dsfDropBoxUploadAcivtityMock.FromPath = "File.txt";
            //---------------Assert Precondition----------------
            Assert.IsNotNull(dsfDropBoxUploadAcivtityMock);
            //---------------Execute Test ----------------------
            var datObj = new Mock <IDSFDataObject>();
            var executionEnvironment = new Mock <IExecutionEnvironment>();

            datObj.Setup(o => o.Environment).Returns(executionEnvironment.Object);
            // ReSharper disable once RedundantAssignment
            IDSFDataObject dataObject = datObj.Object;

            dsfDropBoxUploadAcivtityMock.Execute(dataObject, 0);
            //---------------Test Result -----------------------
            executionEnvironment.Verify(environment => environment.AddError("Please confirm that the correct file destination has been entered"));
        }
Ejemplo n.º 2
0
        public void GetDebugOutputs_GivenWebRequestSuccess_ShouldCorrectDebugValue()
        {
            //---------------Set up test pack-------------------
            var mockExecutor  = new Mock <IDropboxSingleExecutor <IDropboxResult> >();
            var clientWrapper = new Mock <IDropboxClientWrapper>();

            mockExecutor.Setup(executor => executor.ExecuteTask(TestConstant.DropboxClientInstance.Value))
            .Returns(new DropboxUploadSuccessResult(TestConstant.FileMetadataInstance.Value));
            var dsfDropBoxUploadAcivtityMock = new DsfDropBoxUploadActivityMock(mockExecutor.Object, clientWrapper.Object)
            {
                IsUplodValidSuccess = true
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNull(dsfDropBoxUploadAcivtityMock);
            //---------------Execute Test ----------------------
            var esbChannel           = new Mock <IEsbChannel>().Object;
            var datObj               = new Mock <IDSFDataObject>().Object;
            var executionEnvironment = new Mock <IExecutionEnvironment>().Object;
            // ReSharper disable once RedundantAssignment
            var errorResultTO = new ErrorResultTO();

            dsfDropBoxUploadAcivtityMock.Execute(esbChannel, datObj, String.Empty, String.Empty, out errorResultTO, 0);
            var debugOutputs = dsfDropBoxUploadAcivtityMock.GetDebugOutputs(executionEnvironment, 0);

            //---------------Test Result -----------------------
            Assert.AreEqual(0, debugOutputs.Count);
        }