Exemplo n.º 1
0
        public void FileReadWithBase64_TryExecuteConcreteAction_Credential_Variable()
        {
            //------------Setup for test--------------------------
            CreateFileTest(_filePath);
            var env = new ExecutionEnvironment();

            env.Assign("[[val1]]", "demo", false, 0);

            var mockDataObject = new Mock <IDSFDataObject>();

            mockDataObject.Setup(o => o.Environment).Returns(env);
            mockDataObject.Setup(o => o.IsDebugMode()).Returns(true);

            var act = new TestFileReadWithBase64 {
                IsResultBase64 = true, InputPath = _filePath, Result = ""
            };

            act.Username = "******";

            //------------Execute Test---------------------------
            ErrorResultTO to;

            act.TestTryExecuteConcreteAction(mockDataObject.Object, out to, 0);
            var errors = to.FetchErrors();

            Assert.IsTrue(errors.FirstOrDefault()?.Contains("Failed to authenticate with user [ demo ]") ?? false);
        }
Exemplo n.º 2
0
        public void FileReadWithBase64_TryExecuteConcreteAction_IsResultNotBase64_ReturnsOutputStrings()
        {
            //------------Setup for test--------------------------
            CreateFileTest(_filePath);
            const string result = "[[CompanyName]]";
            var          env    = new ExecutionEnvironment();

            var mockDataObject = new Mock <IDSFDataObject>();

            mockDataObject.Setup(o => o.Environment).Returns(env);
            mockDataObject.Setup(o => o.IsDebugMode()).Returns(true);

            var act = new TestFileReadWithBase64 {
                IsResultBase64 = false, InputPath = _filePath, Result = result
            };
            //------------Execute Test---------------------------
            var dsfOutputStrings = act.TestTryExecuteConcreteAction(mockDataObject.Object, out _, 0);

            //------------Assert Results-------------------------
            Assert.AreEqual(1, dsfOutputStrings.Count);
            Assert.AreEqual("some string", dsfOutputStrings[0].OutputStrings[0]);
            Assert.AreEqual(3, act.GetDebugInputs(env, 0).Count);
        }