示例#1
0
        static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Seq("https://seq.octopushq.com", apiKey: "")
                         .Enrich.WithProperty("Application", "HostedWindowsK8Testing")
                         .MinimumLevel.Verbose()
                         .CreateLogger();

            _instances = JsonSerialization.DeserializeObject <Instance[]>(File.ReadAllText(@"services.json"));

            for (int x = 0; x < 2; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    Run(y, 5);
                }

                Thread.Sleep(1000);
            }

            for (int x = 1; x < 20; x++)
            {
                Run(x, 10);
            }


            Console.WriteLine("Running");
            Console.ReadLine();
            _running = false;
        }
        public void LegacyDonorPackageStepIdIsDeserializedIntoDonorPackage_WhenTalkingToOlderServer(
            string donorPackageStepId, string expectedDeploymentAction, string expectedPackageReference)
        {
            var incoming = new
            {
                Template           = (string)null,
                DonorPackageStepId = donorPackageStepId
            };

            var result =
                JsonSerialization.DeserializeObject <VersioningStrategyResource>(JObject.FromObject(incoming).ToString());

            Assert.IsNull(result.Template);
            Assert.AreEqual(expectedDeploymentAction, result.DonorPackage.DeploymentAction);
            Assert.AreEqual(expectedPackageReference, result.DonorPackage.PackageReference);
        }
示例#3
0
        public void LegacyActionsCollectionIsDeserializedIntoActionPackages_WhenTalkingToOlderServer()
        {
            var incoming = new
            {
                VersionRange = "[1.0]",
                Actions      = new[] { "Action 1", "Action 2", "Action 2:Package 1" }
            };

            var result =
                JsonSerialization.DeserializeObject <ChannelVersionRuleResource>(JObject.FromObject(incoming).ToString());

            Assert.AreEqual(incoming.VersionRange, result.VersionRange);
            Assert.AreEqual(3, result.ActionPackages.Count);

            Assert.True(result.ActionPackages.Any(ap => ap.DeploymentAction == "Action 1" && string.IsNullOrEmpty(ap.PackageReference)));
            Assert.True(result.ActionPackages.Any(ap => ap.DeploymentAction == "Action 2" && string.IsNullOrEmpty(ap.PackageReference)));
            Assert.True(result.ActionPackages.Any(ap => ap.DeploymentAction == "Action 2" && ap.PackageReference == "Package 1"));
        }
        private T Clone(T resource)
        {
            var serialized = JsonSerialization.SerializeObject(resource);

            return(JsonSerialization.DeserializeObject <T>(serialized));
        }