Esempio n. 1
0
        public void CreateHostedZoneByName()
        {
            Template   template       = StackTest.GetNewBlankTemplateWithVpc($"Vpc{this.TestContext.TestName}");
            string     hostedZoneName = $"{this.TestContext.TestName}{Guid.NewGuid().ToString().Replace("-", string.Empty)}.com";
            HostedZone hz             = new HostedZone(hostedZoneName);

            template.Resources.Add(hostedZoneName, hz);
            StackTest.CreateTestStack(template, this.TestContext);
        }
        public void CreateTemplateFileTest()
        {
            var template = StackTest.GetTemplateFullStack("yadayadasoftware.com", "dev", StackTest.Greek.Xi, StackTest.Create.FullStack, "No Suffix");

            FileInfo file = TemplateEngine.CreateTemplateFile(template);

            Assert.IsNotNull(file);
            Assert.IsTrue(file.Exists);
        }
Esempio n. 3
0
        public void CreatePrivateHostedZone()
        {
            Template   template       = StackTest.GetNewBlankTemplateWithVpc($"VpcCreatePrivateHostedZone");
            string     hostedZoneName = $"{this.TestContext.TestName}{Guid.NewGuid().ToString().Replace("-", string.Empty)}";
            HostedZone hz             = new HostedZone("example.com");

            template.Resources.Add(hostedZoneName, hz);
            hz.AddVpc(template.Vpcs.First(), Region.UsEast1);
            StackTest.CreateTestStack(template, this.TestContext);
        }
        public void RecordSetByZoneIdTest()
        {
            Template template      = StackTest.GetNewBlankTemplateWithVpc($"Vpc{this.TestContext.TestName}");
            string   recordSetName = $"A{DateTime.Now.Ticks.ToString().Substring(10, 5)}";

            recordSetName = "abc";
            var target = RecordSet.AddByHostedZoneId(template, recordSetName, "Z1H285MI71YUD0", recordSetName + ".sircupsalot.com.", RecordSet.RecordSetTypeEnum.A);

            target.RecordSetType = RecordSet.RecordSetTypeEnum.A.ToString();
            target.AddResourceRecord("206.190.36.45");
            StackTest.CreateTestStack(template, this.TestContext);
        }
Esempio n. 5
0
    public static int Main()
    {
        StackTest testObj = new StackTest();

        TestLibrary.TestFramework.BeginTestCase("for constructor: Stack(IEnumerable<T>)");
        if (testObj.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return(100);
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return(0);
        }
    }
Esempio n. 6
0
    public static int Main()
    {
        StackTest testObj = new StackTest();

        TestLibrary.TestFramework.BeginTestCase("for constructor: Stack(Int32)");
        if (testObj.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }
    }
        public void RecordSetMappedToEipTest()
        {
            Template template  = StackTest.GetNewBlankTemplateWithVpc($"Vpc{this.TestContext.TestName}");
            var      DMZSubnet = new Subnet(template.Vpcs.First(), "10.0.0.0/20", AvailabilityZone.UsEast1A, true);

            template.Resources.Add("DMZSubnet", DMZSubnet);

            Instance testBox = new Instance(DMZSubnet, InstanceTypes.T2Micro, "ami-60b6c60a", OperatingSystem.Linux);

            template.Resources.Add("testbox", testBox);
            var eip    = testBox.AddElasticIp();
            var target = RecordSet.AddByHostedZoneName(template, "test", "getthebuybox.com.", "test.test.getthebuybox.com.", RecordSet.RecordSetTypeEnum.A);

            target.TTL           = "60";
            target.RecordSetType = RecordSet.RecordSetTypeEnum.A.ToString();
            target.AddResourceRecord(new ReferenceProperty(eip));
            StackTest.CreateTestStack(template, this.TestContext);
        }
        public void RecordSetByNewHostZoneTest()
        {
            Template   template = StackTest.GetNewBlankTemplateWithVpc($"Vpc{this.TestContext.TestName}");
            HostedZone hz       = new HostedZone("zeta.yadayada.software.");

            template.Resources.Add("hostedZoneRecordSetByNewHostZoneTest", hz);
            hz.AddVpc(template.Vpcs.First(), Region.UsEast1);
            var target = RecordSet.AddByHostedZone(template, "test", hz, "test.zeta.yadayada.software.", RecordSet.RecordSetTypeEnum.A);

            target.TTL           = "60";
            target.RecordSetType = RecordSet.RecordSetTypeEnum.A.ToString();
            var DMZSubnet = new Subnet(template.Vpcs.First(), "10.0.0.0/20", AvailabilityZone.UsEast1A, true);

            template.Resources.Add("DMZSubnet", DMZSubnet);

            Instance testBox = new Instance(DMZSubnet, InstanceTypes.T2Micro, "ami-60b6c60a", OperatingSystem.Linux);

            template.Resources.Add("testbox", testBox);
            var eip = testBox.AddElasticIp();

            target.AddResourceRecord(eip);
            StackTest.CreateTestStack(template, this.TestContext);
        }
Esempio n. 9
0
    void OnGUI()
    {
        if (GUILayout.Button("Code Time Test"))
        {
            content1 = codeTimeTest();
            content2 = "";
            content3 = "";
        }

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("数组-添加字符串数组"))
        {
            ArrayTest tester = new ArrayTest();
            content1 = "Array : " + tester.addStrToStrArray();
            content2 = "ArrayList : " + tester.addStrToArrayList();
            content3 = "";
        }

        if (GUILayout.Button("数组-添加整型数组"))
        {
            ArrayTest tester = new ArrayTest();
            content1 = "Array : " + tester.addStrToStrArray();
            content2 = "ArrayList : " + tester.addStrToArrayList();
            content3 = "";
        }

        GUILayout.EndHorizontal();

        System.Action <ISorter <int> > sort = (ISorter <int> sorter) =>
        {
            CodeTimeTester timer = new CodeTimeTester();
            List <int>     list  = CodeTester.GetRandomIntList(10);
            content1 = "";
            list.ForEach(i => { content1 += i + " "; });

            timer.StartTime();
            sorter.Sort(list);
            timer.StopTime();

            content2 = getIntListContent(list);
            content3 = "耗时: " + timer.duration;
        };

        if (GUILayout.Button("冒泡排序"))
        {
            BubbleSort <int> sorter = new BubbleSort <int>();
            sort(sorter);
        }

        if (GUILayout.Button("快速排序"))
        {
            QuickSort <int> sorter = new QuickSort <int>();
            sort(sorter);
        }

        if (GUILayout.Button("选择排序"))
        {
            SelectionSort <int> sorter = new SelectionSort <int>();
            sort(sorter);
        }

        if (GUILayout.Button("插入排序"))
        {
            InsertionSort <int> sorter = new InsertionSort <int>();
            sort(sorter);
        }

        if (GUILayout.Button("希尔排序"))
        {
            ShellSort <int> sorter = new ShellSort <int>();
            sort(sorter);
        }

        if (GUILayout.Button("归并排序"))
        {
            MergeSort <int> sorter = new MergeSort <int>();
            sort(sorter);
        }

        if (GUILayout.Button("基数排序"))
        {
            RadixSort <int> sorter = new RadixSort <int>();
            sort(sorter);
        }

        if (GUILayout.Button("Stack - (5+6+3)"))
        {
            StackTest stack = new StackTest();
            content1 = stack.Test();
        }

        if (GUILayout.Button("Stack - 进制转换"))
        {
            StackTest stack = new StackTest();
            content1 = stack.MulBaseTest();
        }


        if (GUILayout.Button("BitArray - 素数"))
        {
            List <int> list = new List <int>();
            for (int i = 0; i < 100; ++i)
            {
                list.Add(1);
            }

            BitArrayTest bat = new BitArrayTest();

            content1 = bat.GetPrimes(list.ToArray());
        }


        scrollPos = GUILayout.BeginScrollView(scrollPos);
        GUILayout.Label(content1);
        GUILayout.Label(content2);
        GUILayout.Label(content3);
        GUILayout.EndScrollView();
    }
 static void Main()
 {
     StackTest.Test();
     QueueTest.Test();
     LinkedListTest.Test();
 }