public void Given_ValidFile_When_ReadToolInfoInvoked_Exptected_EqualListValues()
        {
            ToolConfiguration toolConfiguration = new ToolConfiguration();
            List <ToolData>   actualValue       = toolConfiguration.ReadToolInfo(@"..\..\..\ToolConfigurationLib.Test\TestFiles\ToolsInfo.xml");
            List <ToolData>   exptectedValue    = new List <ToolData>();

            actualValue.Add(new ToolData("StyleCopToolLib.StyleCopTool",
                                         "..\\..\\..\\StyleCopToolLib\\bin\\Debug\\StyleCopToolLib.dll",
                                         @"C:\Users\320068391\Desktop\stylecopcli_1.4.0.0_bin (2)\StyleCopCLI.exe",
                                         "..\\..\\..\\GeneratedFiles"));
            actualValue.Add(new ToolData("FxCopToolLib.FxCopTool", "..\\..\\..\\FxCopToolLib\\bin\\Debug\\FxCopToolLib.dll",
                                         @"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\Community\\Team Tools\\Static Analysis Tools\\FxCop\\FxCopCmd.exe",
                                         "..\\..\\..\\GeneratedFiles"));

            int k = 1;

            foreach (var i in actualValue)
            {
                foreach (var j in exptectedValue)
                {
                    if (i.ToolName != j.ToolName || i.ToolExe != j.ToolExe ||
                        i.ToolDLLPath != j.ToolDLLPath || i.OutputDirectoryPath != j.OutputDirectoryPath)
                    {
                        k = 0;
                        break;
                    }
                }
            }

            Assert.AreEqual(1, k);
        }
        public void Given_ValidFileWithTwoToolInfoEntry_When_ReadToolInfoInvoked_Exptected_ReturnedListSizeTwo()
        {
            ToolConfiguration toolConfiguration = new ToolConfiguration();
            List <ToolData>   toolOutputs       = toolConfiguration.ReadToolInfo(@"..\..\..\ToolConfigurationLib.Test\TestFiles\ToolsInfo.xml");
            int actualValue   = toolOutputs.Count;
            int expectedValue = 2;

            Assert.AreEqual(actualValue, expectedValue);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Call every tool with corresponding inputs and generate the xml files
 /// </summary>
 /// <param name="input">list of input data</param>
 public void StartSession(List <string> input)
 {
     if (input.Count > 0)
     {
         string            filePath          = "..\\ToolsInfo.xml";
         ToolConfiguration toolConfiguration = new ToolConfiguration();
         List <ToolData>   toolInfo          = toolConfiguration.ReadToolInfo(filePath);
         ToolsRunner       toolRunner        = new ToolsRunner();
         toolRunner.RunTools(toolInfo, input);
     }
     else
     {
         string message = "Argument is not valid";
         throw new ArgumentNullException(message);
     }
 }
        public void Given_File_When_ReadToolInfoInvoked_Exptected_FileNotFound()
        {
            ToolConfiguration toolConfiguration = new ToolConfiguration();

            toolConfiguration.ReadToolInfo("abc");
        }