コード例 #1
0
        private static GenericResourceData GetGenericResource(
            Dictionary <string, string> tags,
            Resources.Models.Sku sku,
            Plan plan,
            string kind,
            string managedBy,
            string location)
        {
            ResourceIdentifier id = new ResourceIdentifier($"/subscriptions/{Guid.NewGuid()}/resourceGroups/myResourceGroup/providers/Microsoft.Widgets/widgets/myWidget");

            return(new GenericResourceData(id, id.Name, id.ResourceType, location, tags, plan, null, kind, managedBy, sku, null, null, null, null));
        }
コード例 #2
0
        public void SerializationTestType1()
        {
            string             expected = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "Unit", "TestAssets", "GenericResourceData", "SerializationTestType1.json"));
            ResourceIdentifier id       = new ResourceIdentifier(Id);
            Plan plan = new Plan("NameForPlan", "PublisherForPlan", "ProductForPlan", "PromotionCodeForPlan", "VersionForPlan");

            Resources.Models.Sku sku  = new Resources.Models.Sku("NameForSku", SkuTier.Basic.ToString(), "SizeForSku", "FamilyForSku", "ModelForSku", 15464547);
            GenericResourceData  data = new GenericResourceData(id, id.Name, id.ResourceType, Location.EastUS, new Dictionary <string, string>(), plan, null, "KindForResource", "ManagedByForResource", sku, null, null, null, null);

            var json = JsonHelper.SerializePropertiesToString(data, indented: true) + Environment.NewLine;

            Assert.AreEqual(expected, json);
        }