Exemplo n.º 1
0
        public void DsfPathDelete_GetState_ReturnsStateVariable()
        {
            //---------------Set up test pack-------------------
            //------------Setup for test--------------------------
            var act = new DsfPathDelete
            {
                InputPath      = "[[InputPath]]",
                Username       = "******",
                PrivateKeyFile = "abcde",
                Result         = "[[res]]"
            };
            //------------Execute Test---------------------------
            var stateItems = act.GetState();

            Assert.AreEqual(4, stateItems.Count());

            var expectedResults = new[]
            {
                new StateVariable
                {
                    Name  = "InputPath",
                    Type  = StateVariable.StateType.InputOutput,
                    Value = "[[InputPath]]"
                },
                new StateVariable
                {
                    Name  = "Username",
                    Type  = StateVariable.StateType.Input,
                    Value = "Bob"
                },
                new StateVariable
                {
                    Name  = "PrivateKeyFile",
                    Type  = StateVariable.StateType.Input,
                    Value = "abcde"
                },
                new StateVariable
                {
                    Name  = "Result",
                    Type  = StateVariable.StateType.Output,
                    Value = "[[res]]"
                }
            };

            var iter = act.GetState().Select(
                (item, index) => new
            {
                value       = item,
                expectValue = expectedResults[index]
            }
                );

            //------------Assert Results-------------------------
            foreach (var entry in iter)
            {
                Assert.AreEqual(entry.expectValue.Name, entry.value.Name);
                Assert.AreEqual(entry.expectValue.Type, entry.value.Type);
                Assert.AreEqual(entry.expectValue.Value, entry.value.Value);
            }
        }