コード例 #1
0
        public static void GetItem_Parallel_Succeeds()
        {
            // Arrange
            var sourceTool = Helpers.SetUpRealGitSourceTool();

            var sourceInformation = new SourceInformation(
                SourceType.TfsGit,
                "Upmc.DevTools.Common.sln",
                false,
                "Upmc.DevTools.Common",
                "develop");

            var items = new ushort[10];

            Parallel.ForEach(items, (item, state, index) =>
            {
                var sw = Stopwatch.StartNew();

                // Act
                var result = sourceTool.GetItem(sourceInformation);

                // Assert
                Assert.That(result, Is.Not.Null);

                Console.WriteLine($"Index {index}, Elapsed {sw.Elapsed}");

                var myHandlers = new VariableDumpHandlers();
                Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
            });
        }
コード例 #2
0
        public static void GetIndent_Throws(
            [Values(-1, 100)] int input
            )
        {
            var x = new VariableDumpHandlers(10, " ");

            Assert.That(() => x.GetIndent(input), Throws.TypeOf <ArgumentOutOfRangeException>());
        }
コード例 #3
0
        public static void GetPolicyConfigurations_succeeds()
        {
            var policyTool = SetUpIntegration();

            var result = policyTool.GetPolicyConfiguration(1);

            Assert.That(result, Is.Not.Null);

            var myHandlers = new VariableDumpHandlers();

            Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
        }
コード例 #4
0
        public static void GetQueue_succeeds()
        {
            var tool = SetUpIntegration();

            var result = tool.GetQueue(264);

            Assert.That(result, Is.Not.Null);

            var myHandlers = new VariableDumpHandlers();

            Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
        }
コード例 #5
0
        //[TestCase(typeof(object), typeof(object))]
        public static void HandleItem_ForDictionary_ReturnsResult(Type type1, Type type2)
        {
            var dictType = typeof(Dictionary <,>).MakeGenericType(type1, type2);
            var input    = Activator.CreateInstance(dictType);

            var result = new VariableDumpHandlers().HandleItem(input, 0);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Length, Is.GreaterThan(0));

            // todo Use expectedResult?
        }
コード例 #6
0
        public static void GetVariableGroupNames_succeeds()
        {
            var variableGroupTool = SetUpIntegration();

            var result = variableGroupTool.GetVariableGroupNames();

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count, Is.GreaterThan(0));

            var myHandlers = new VariableDumpHandlers();

            Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
        }
コード例 #7
0
        public static void HandleItem_ForDictionary_WithValues_ReturnsResult()
        {
            var input = new Dictionary <string, string> {
                { "a", "1" }, { "b", "2" }
            };

            var result = new VariableDumpHandlers().HandleItem(input, 0);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Length, Is.GreaterThan(0));

            // todo Use expectedResult?
        }
コード例 #8
0
        public static void GetProjects()
        {
            var pat = AuthenticationHelper.GetPersonalAccessToken();

            var vsTsTool = new VsTsTool(pat);

            var result = vsTsTool.GetProjects();

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count(), Is.GreaterThan(0));

            var myHandlers = new VariableDumpHandlers();

            Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
        }
コード例 #9
0
        public void GetReleaseDefinitions_Succeeds()
        {
            SetUpIntegration();

            const string name = ReleaseName;

            var result = _releaseTool.GetReleaseDefinitions(name);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count(), Is.EqualTo(1));
            Assert.That(result.First().Name, Is.EqualTo(name));

            var myHandlers = new VariableDumpHandlers();

            Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
        }
コード例 #10
0
        public static void GetTaskGroups_succeeds()
        {
            var taskGroupTool = SetUpIntegration();

            var result = taskGroupTool.GetTaskGroups();

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count(), Is.GreaterThan(0));

            Console.WriteLine($"Found {result.Count()} taskGroupStep groups.");
            Console.WriteLine("");

            var myHandlers = new VariableDumpHandlers();

            Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
        }
コード例 #11
0
        public void GetBuildDefinition_Succeeds()
        {
            var realBuildTool = Helpers.SetUpRealBuildTool(out _, _pc);

            var definitions = realBuildTool.GetBuildDefinitionReferences();

            var random = new Random(DateTime.Now.Millisecond);

            var randomDefinition = definitions.Skip(random.Next(1, definitions.Count()) - 1).First();

            var result = realBuildTool.GetBuildDefinition(randomDefinition.Id) as BuildDefinitionReference;

            Assert.That(result, Is.Not.Null);

            result.Should().BeEquivalentTo(
                randomDefinition,
                options => options
                .IncludingNestedObjects()    // Nested objects should be equivalent.
                .Excluding(x => x.Links)     // Links are specific to each item and won't match.
                //.Excluding(x => x.BuildNumberFormat)
                //.Excluding(x => x.Comment)
                //.Excluding(x => x.Description)
                //.Excluding(x => x.DropLocation)
                //.Excluding(x => x.JobAuthorizationScope)
                //.Excluding(x => x.JobTimeoutInMinutes)
                //.Excluding(x => x.JobCancelTimeoutInMinutes)
                //.Excluding(x => x.BadgeEnabled)
                //.Excluding(x => x.Steps)
                //.Excluding(x => x.Process)
                //.Excluding(x => x.Options)
                //.Excluding(x => x.Repository)
                //.Excluding(x => x.ProcessParameters)
                //.Excluding(x => x.Triggers)
                //.Excluding(x => x.Variables)
                //.Excluding(x => x.VariableGroups)
                //.Excluding(x => x.Counters)
                //.Excluding(x => x.Demands)
                //.Excluding(x => x.RetentionRules)
                //.Excluding(x => x.Properties)
                //.Excluding(x => x.Tags)
                );

            var myHandlers = new VariableDumpHandlers();

            Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
        }
コード例 #12
0
        public static void GetItems_Succeeds()
        {
            // Arrange
            var sourceTool = SetUpIntegration();

            var sourceInformation = new SourceInformation(
                SourceType.TfsVc,
                "$/Apollo/HP/Source/Tools/DependencyGrapher",
                true);

            // Act
            var result = sourceTool.GetItems(sourceInformation);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count(), Is.GreaterThan(2));

            var myHandlers = new VariableDumpHandlers();

            Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
        }
コード例 #13
0
        public static void GetItems_Succeeds([Values] bool isDirectory)
        {
            // Arrange
            var sourceTool = new FilesystemSourceTool();

            var sourceInformation = isDirectory
                ? new SourceInformation(SourceType.Filesystem, @"C:\gh\AzureDevOpsLibrary", true)
                : new SourceInformation(
                SourceType.Filesystem,
                @"C:\gh\AzureDevOpsLibrary\AdoTools.Ado\AdoTools.Ado.csproj",
                false);

            // Act
            var result = sourceTool.GetItems(
                sourceInformation,
                isDirectory
                    ? "*.csproj"
                    : null);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(
                result.Count(),
                Is.EqualTo(
                    isDirectory
                        ? 8
                        : 1));

            try
            {
                var myHandlers = new VariableDumpHandlers();
                Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
            }
            catch (ArgumentOutOfRangeException exception)
            {
                Console.WriteLine(exception);
            }
        }
コード例 #14
0
        public static void Search_NuGetOrg_ReturnsExpectedResult(string packageName, bool exactMatch,
                                                                 bool expectedResult)
        {
            var tool = new NuGetTool();

            Assert.That(tool, Is.Not.Null);

            var result = tool.Search(packageName, exactMatch: exactMatch);

            Assert.That(result, Is.Not.Null);

            foreach (var item in result)
            {
                Console.WriteLine($"ID: {item.Identity.Id} Version: {item.Identity.Version}");
            }

            if (expectedResult)
            {
                Assert.That(result.Count(), Is.GreaterThan(0));
            }
            else
            {
                Assert.That(result.Count(), Is.EqualTo(0));
            }

            try
            {
                var myHandlers = new VariableDumpHandlers();
                Console.WriteLine(result.DumpValues(0, handlers: myHandlers));
            }
            catch (ArgumentOutOfRangeException exception)
            {
                Console.WriteLine(exception);
                // there is a loop somewhere in this object.
            }
        }
コード例 #15
0
        public static void HandleItem_ReturnsExpectedResult(object input, string expectedOutput)
        {
            var result = new VariableDumpHandlers().HandleItem(input, 0);

            Assert.That(result, Is.EqualTo(expectedOutput));
        }