Skip to content
This repository was archived by the owner on Jun 17, 2019. It is now read-only.
This repository was archived by the owner on Jun 17, 2019. It is now read-only.

Unique properties in configuration variables are not always resolved correctly #20

@DanielBMann9000

Description

@DanielBMann9000

Only the first instance of a second unique parameter is properly resolved; everything after resolves to the first instance.

Repro unit test:

        [TestMethod]
        public void A_Set_Of_NonSequential_Identical_Parameters_That_Take_A_Combination_Of_Different_And_Same_Values_Are_Made_Unique()
        {
            // Arrange
            var actions = new List<ScriptAction>
                                   {
                                       new ScriptAction
                                           {
                                               Arguments = @"-Param __Hello World__",
                                               ConfigurationVariables =
                                                   new List<ConfigurationVariable>
                                                       {
                                                           new ConfigurationVariable { OriginalName = "Hello World", Value = "placeholder" }
                                                       }
                                           },
                                       new ScriptAction
                                           {
                                               Arguments = @"-Param __Hello World__",
                                               ConfigurationVariables =
                                                   new List<ConfigurationVariable>
                                                       {
                                                           new ConfigurationVariable { OriginalName = "Hello World", Value = "Bar" }
                                                       }
                                           },
                                           new ScriptAction
                                           {
                                               Arguments = @"-Param __Hello World__",
                                               ConfigurationVariables =
                                                   new List<ConfigurationVariable>
                                                       {
                                                           new ConfigurationVariable { OriginalName = "Hello World", Value = "placeholder" }
                                                       }
                                           },
                                       new ScriptAction
                                           {
                                               Arguments = @"-Param __Hello World__",
                                               ConfigurationVariables =
                                                   new List<ConfigurationVariable>
                                                       {
                                                           new ConfigurationVariable { OriginalName = "Hello World", Value = "Bar" }
                                                       }
                                           }
                                   };

            // Act
            var results = UniquePropertyResolver.ResolveProperties(actions).ToList();

            // Assert
            Assert.AreEqual("-Param $HelloWorld", results[0].Arguments);
            Assert.IsTrue(results[0].ConfigurationVariables.All(cv => cv.RemappedName == "HelloWorld"));
            Assert.AreEqual("-Param $HelloWorld2", results[1].Arguments);
            Assert.IsTrue(results[1].ConfigurationVariables.All(cv => cv.RemappedName == "HelloWorld2"));
            Assert.AreEqual("-Param $HelloWorld", results[2].Arguments);
            Assert.IsTrue(results[2].ConfigurationVariables.All(cv => cv.RemappedName == "HelloWorld"));
            Assert.AreEqual("-Param $HelloWorld2", results[3].Arguments); // Fails here
            Assert.IsTrue(results[3].ConfigurationVariables.All(cv => cv.RemappedName == "HelloWorld2")); // Fails here
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions