Beispiel #1
0
        public override TaskResult StartTask()
        {
            Console.WriteLine($"Arg1: '{Arg1}'");
            Console.WriteLine($"Arg2: '{Arg2}'");

            return(TaskResult.Complete());
        }
Beispiel #2
0
 public override TaskResult StartTask()
 {
     try
     {
         UniversalPropertyIdentifier upi = Upi;
         if (upi.IsValid())
         {
             Console.WriteLine($"\n{upi.Description}");
             return(TaskResult.Complete());
         }
         return(TaskResult.Failed(upi.Description));
     }
     catch (Exception ex)
     {
         return(TaskResult.Exception(ex));
     }
 }
        public override TaskResult StartTask()
        {
            var data = new List <string[]>()
            {
                new string[] { "Darth", "Vader", "Sith", "Empire" },
                new string[] { "Luke", "Skywalker", "Jedi", "Rebellion" },
                new string[] { "Leia", "Organa", "Princess", "Rebellion" },
            };

            var data2 = new List <Bag>()
            {
                new Bag()
                {
                    Name = "X-Wing", Length = 105, Decription = "Cool Starfighter"
                },
                new Bag()
                {
                    Name = "TIE Fighter", Length = 162, Decription = "Freaky fast and meneuverable fighter"
                },
                new Bag()
                {
                    Name = "Millenium Falcon", Length = 783, Decription = "THe ship that made the Kessel Run in less than 12 parsecs"
                },
            };

            var table = new TextTable()
                        .AddColumn("Col1", 12)
                        .AddColumn("col2", 4, AlignmentType.Center)
                        .AddColumn("col3", 12, AlignmentType.Right)
            ;

            var table2 = new TextTable()
                         .AddColumn("Col1", 12)
                         .AddColumn("col2", 4, AlignmentType.Center)
                         .AddColumn("col3", 12, AlignmentType.Right)
            ;

            Console.WriteLine(table.Render(data));
            Console.WriteLine(table2.Render(data2));
            Console.WriteLine(new TextTable().Render(data2));
            Console.WriteLine(new TextTable().Render(data2.Select(o => new { Vehicle = o.Name, LOA = o.Length, CatchPhrase = o.Decription })));
            Console.WriteLine(new TextTable().Render(data2.Select(o => new { Vehicle = o.Name, Catch_Phrase = o.Decription })));

            return(TaskResult.Complete());
        }
Beispiel #4
0
        public override TaskResult StartTask()
        {
            var allTests = new Dictionary <string, List <string> >()
            {
                {
                    "dynamic", new List <string>()
                    {
                        "test-dynamic1 -name MyDynamicTask",
                        "test-dynmaic2"
                    }
                },
                {
                    "packages", new List <string>()
                    {
                        "runpackage -name TestPackage",
                    }
                }
            };

            var runAllTests = Name.Length == 0;

            if (!runAllTests && !allTests.ContainsKey(Name))
            {
                Console.WriteLine($"Test '{Name}' not found. Tests defined are:");
                foreach (var test in allTests)
                {
                    Console.WriteLine($"   {Name}");
                }
                return(TaskResult.Failed($"No test '{Name}' is defined."));
            }
            else
            {
                foreach (var test in allTests)
                {
                    if ((test.Key == Name) || runAllTests)
                    {
                        Console.WriteLine($"Running Test: {Name}");
                        RunTestGroup(test.Value);
                    }
                }
            }

            return(TaskResult.Complete());
        }
        public override TaskResult StartTask()
        {
            string[] sampleUpis =
            {
                "US-04015-N -11022331-R-N",
                "US-42049-49888-1213666-R-N",
                "US-36061-N- 010237502R1-R-N",
                "US-36061-N-010237502R1-S-113",
                "US-06075-N-40010333-T-10",
                "US-13051-N-1122444-R-N",
                "US-36061-N-0122213-S-118",
                "US-04019-N-12401001H-B-65A",
                "US-123331-N-N-99798987-99",
                "US-123331-N-87-99",                // BAD UPI
                "XX-123331-N-N-99798987-99",        // BAD UPI
                "OIOASPODASDO APOSAPSCAS"           // BAD UPI
            };

            foreach (var upiText in sampleUpis)
            {
                try
                {
                    UniversalPropertyIdentifier upi = upiText;
                    Console.WriteLine($"\n{upi.Description}");
                }
                catch (Exception ex)
                {
                    return(TaskResult.Exception(ex));
                }
            }

            // Naked UPI
            var nakedUpi1 = new UniversalPropertyIdentifier(IsoCountryCode.US)
            {
                SubCountry   = "13051-N",
                Property     = "123-456-789",
                PropertyType = SubPropertyTypeCode.S,
                SubProperty  = "909"
            };

            Console.WriteLine($"\n{nakedUpi1}");

            var nakedUpi2 = new UniversalPropertyIdentifier(
                IsoCountryCode.US, "06075-N", "144-90-8822"
                );

            Console.WriteLine($"\n{nakedUpi2}");

            var testUpi = new UniversalPropertyIdentifier("US-42049-49888-1213666-R-N");
            var test2   = (UnitedStatesUpi)testUpi.CountrySpecificUpi;

            Console.WriteLine($"\nCountry-Specific UPI type detected {test2.CountryName} ({testUpi.CountrySpecificUpi.GetType().ToString()}) ");

            var countryName = TargetName("US-36061-N-010237502R1-S-113");

            Console.Write(countryName);

            // Build a United States UPIs

            var upiByCountry = new UnitedStatesUpi()
            {
                FipsCounty    = FipsCache.GetCounty("04013"),
                FipsSubCounty = FipsCache.GetSubCounty("N"),
                Property      = "508-41-188",
                PropertyType  = SubPropertyTypeCode.B,
                SubProperty   = "65A"
            };

            Console.WriteLine($"\n{upiByCountry.Description}");

            // minimal property construction by components
            var upiByCountry2 = new UnitedStatesUpi()
            {
                FipsCounty    = FipsCache.GetCounty("04015"),
                FipsSubCounty = FipsSubCountyEntry.Undefined(),
                Property      = "508-41-188"
            };

            Console.WriteLine($"\n{upiByCountry2.Description}");

            var upiByCountry3 = new UnitedStatesUpi()
            {
                FipsCounty    = FipsCache.GetCounty("04019"),
                FipsSubCounty = FipsSubCountyEntry.Undefined(),
                Property      = "508-41-188",
                PropertyType  = SubPropertyTypeCode.B,
                SubProperty   = "65A"
            };

            Console.WriteLine($"\n{upiByCountry3.Description}");

            var upiByCountry4 = new UnitedStatesUpi("US-42049-49888-1213666-R-N");

            Console.WriteLine($"\n{upiByCountry4.Description}");

            return(TaskResult.Complete());
        }
Beispiel #6
0
 public override TaskResult StartTask()
 {
     Console.WriteLine($"Alias TEST executing...");
     WriteArguments();
     return(TaskResult.Complete());
 }
Beispiel #7
0
 public override TaskResult StartTask()
 {
     Console.WriteLine($"Running PackageTestCaseB");
     return(TaskResult.Complete("Packaged Task Successful"));
 }