Exemple #1
0
        public void EqualsToNullPlan()
        {
            ArmPlan plan1 = new ArmPlan(null, null, null, null, null);
            ArmPlan plan2 = null;

            Assert.IsFalse(plan1.Equals(plan2));
        }
Exemple #2
0
        public void EqualOperatorNull()
        {
            ArmPlan plan1 = new ArmPlan("PlanName", null, null, "PlanPromo", null);

            Assert.IsFalse(plan1 == null);
            Assert.IsFalse(null == plan1);
        }
Exemple #3
0
        public void EqualsToSamePlans()
        {
            ArmPlan plan1 = new ArmPlan(null, null, null, null, null);
            ArmPlan plan2 = plan1;

            Assert.IsTrue(plan1.Equals(plan2));
        }
Exemple #4
0
        public void NotEqualsToOperator(bool expected, string name1, string name2, string promo1, string promo2)
        {
            ArmPlan plan1 = new ArmPlan(name1, null, null, promo1, null);
            ArmPlan plan2 = new ArmPlan(name2, null, null, promo2, null);

            Assert.AreEqual(expected, plan1 != plan2);
        }
Exemple #5
0
        public void EqualsToVersion(bool expected, string version1, string version2)
        {
            ArmPlan plan1 = new ArmPlan(null, null, null, null, version1);
            ArmPlan plan2 = new ArmPlan(null, null, null, null, version2);

            Assert.AreEqual(expected, plan1.Equals(plan2), "Plans did not match expected equality");
            Assert.AreEqual(expected, plan1.GetHashCode() == plan2.GetHashCode(), $"Hashcodes comparison was expect {expected} but was {!expected}, ({plan1.GetHashCode()}, {plan2.GetHashCode()})");
        }
 internal ResourceModelWithAllowedPropertySet(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string managedBy, string kind, string etag, SystemAssignedServiceIdentity identity, ResourceModelWithAllowedPropertySetSku sku, ArmPlan plan) : base(id, name, resourceType, systemData, tags, location)
 {
     ManagedBy = managedBy;
     Kind      = kind;
     Etag      = etag;
     Identity  = identity;
     Sku       = sku;
     Plan      = plan;
 }
Exemple #7
0
        public void InvalidDeserializationTest()
        {
            string      json    = "{\"name\":\"NameForPlan\",\"notPublisher\":\"PublisherForPlan\",\"product\":\"ProductForPlan\",\"version\":\"VersionForPlan\"}";
            JsonElement element = JsonDocument.Parse(json).RootElement;
            ArmPlan     plan    = ArmPlan.DeserializeArmPlan(element);

            Assert.IsTrue(plan.Publisher == null);
            Assert.IsTrue(plan.PromotionCode == null);
        }
Exemple #8
0
        private static GenericResourceData GetGenericResource(
            Dictionary <string, string> tags,
            ResourcesSku sku,
            ArmPlan 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, null, tags, location, null, plan, null, kind, managedBy, sku, null, null, null, null));
        }
Exemple #9
0
        public void SerializationTestType1()
        {
            string              expected = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "Unit", "TestAssets", "GenericResourceData", "SerializationTestType1.json"));
            ResourceIdentifier  id       = new ResourceIdentifier(Id);
            ArmPlan             plan     = new ArmPlan("NameForPlan", "PublisherForPlan", "ProductForPlan", "PromotionCodeForPlan", "VersionForPlan");
            ResourcesSku        sku      = new ResourcesSku("NameForSku", ArmSkuTier.Basic.ToString(), "SizeForSku", "FamilyForSku", "ModelForSku", 15464547);
            GenericResourceData data     = new GenericResourceData(id, id.Name, id.ResourceType, null, new Dictionary <string, string>(), AzureLocation.EastUS, null, plan, null, "KindForResource", "ManagedByForResource", sku, null, null, null, null);

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

            Assert.AreEqual(expected, json);
        }
Exemple #10
0
 internal GenericResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, ArmPlan plan, BinaryData properties, string kind, string managedBy, ResourcesSku sku, ManagedServiceIdentity identity, DateTimeOffset?createdOn, DateTimeOffset?changedOn, string provisioningState) : base(id, name, resourceType, systemData, tags, location, extendedLocation)
 {
     Plan              = plan;
     Properties        = properties;
     Kind              = kind;
     ManagedBy         = managedBy;
     Sku               = sku;
     Identity          = identity;
     CreatedOn         = createdOn;
     ChangedOn         = changedOn;
     ProvisioningState = provisioningState;
 }
Exemple #11
0
        public void EqualsToObject()
        {
            ArmPlan plan1      = new ArmPlan(null, null, null, null, null);
            object  stringPlan = "random";

            Assert.IsFalse(plan1.Equals(stringPlan));

            object nullObject = null;

            Assert.IsFalse(plan1.Equals(nullObject));

            object samePlan = plan1;

            Assert.IsTrue(plan1.Equals(samePlan));

            object plan2 = new ArmPlan("Plan2", null, null, null, null);

            Assert.IsFalse(plan1.Equals(plan2));
        }
Exemple #12
0
 internal ArmApplicationPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string managedBy, ArmApplicationSku sku, ArmPlan plan, string kind, ArmApplicationManagedIdentity identity, ResourceIdentifier managedResourceGroupId, ResourceIdentifier applicationDefinitionId, BinaryData parameters, BinaryData outputs, ResourcesProvisioningState?provisioningState, ArmApplicationBillingDetails billingDetails, ArmApplicationJitAccessPolicy jitAccessPolicy, Guid?publisherTenantId, IReadOnlyList <ArmApplicationAuthorization> authorizations, ArmApplicationManagementMode?managementMode, ArmApplicationPackageContact customerSupport, ArmApplicationPackageSupportUris supportUris, IReadOnlyList <ArmApplicationArtifact> artifacts, ArmApplicationDetails createdBy, ArmApplicationDetails updatedBy) : base(id, name, resourceType, systemData, tags, location, managedBy, sku)
 {
     Plan     = plan;
     Kind     = kind;
     Identity = identity;
     ManagedResourceGroupId  = managedResourceGroupId;
     ApplicationDefinitionId = applicationDefinitionId;
     Parameters        = parameters;
     Outputs           = outputs;
     ProvisioningState = provisioningState;
     BillingDetails    = billingDetails;
     JitAccessPolicy   = jitAccessPolicy;
     PublisherTenantId = publisherTenantId;
     Authorizations    = authorizations;
     ManagementMode    = managementMode;
     CustomerSupport   = customerSupport;
     SupportUris       = supportUris;
     Artifacts         = artifacts;
     CreatedBy         = createdBy;
     UpdatedBy         = updatedBy;
 }
Exemple #13
0
 internal VirtualWorkspaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string managedBy, string kind, string etag, SystemAssignedServiceIdentity identity, ResourceModelWithAllowedPropertySetSku sku, ArmPlan plan, string objectId, string description, string friendlyName, IList <string> applicationGroupReferences, bool?cloudPcResource) : base(id, name, resourceType, systemData, tags, location, managedBy, kind, etag, identity, sku, plan)
 {
     ObjectId     = objectId;
     Description  = description;
     FriendlyName = friendlyName;
     ApplicationGroupReferences = applicationGroupReferences;
     CloudPcResource            = cloudPcResource;
 }
 internal HostPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string managedBy, string kind, string etag, SystemAssignedServiceIdentity identity, ResourceModelWithAllowedPropertySetSku sku, ArmPlan plan, string objectId, string friendlyName, string description, HostPoolType hostPoolType, PersonalDesktopAssignmentType?personalDesktopAssignmentType, string customRdpProperty, int?maxSessionLimit, LoadBalancerType loadBalancerType, int?ring, bool?validationEnvironment, RegistrationInfo registrationInfo, string vmTemplate, IReadOnlyList <string> applicationGroupReferences, string ssoadfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, SsoSecretType?ssoSecretType, PreferredAppGroupType preferredAppGroupType, bool?startVmOnConnect, MigrationRequestProperties migrationRequest, bool?cloudPcResource) : base(id, name, resourceType, systemData, tags, location, managedBy, kind, etag, identity, sku, plan)
 {
     ObjectId     = objectId;
     FriendlyName = friendlyName;
     Description  = description;
     HostPoolType = hostPoolType;
     PersonalDesktopAssignmentType = personalDesktopAssignmentType;
     CustomRdpProperty             = customRdpProperty;
     MaxSessionLimit             = maxSessionLimit;
     LoadBalancerType            = loadBalancerType;
     Ring                        = ring;
     ValidationEnvironment       = validationEnvironment;
     RegistrationInfo            = registrationInfo;
     VmTemplate                  = vmTemplate;
     ApplicationGroupReferences  = applicationGroupReferences;
     SsoadfsAuthority            = ssoadfsAuthority;
     SsoClientId                 = ssoClientId;
     SsoClientSecretKeyVaultPath = ssoClientSecretKeyVaultPath;
     SsoSecretType               = ssoSecretType;
     PreferredAppGroupType       = preferredAppGroupType;
     StartVmOnConnect            = startVmOnConnect;
     MigrationRequest            = migrationRequest;
     CloudPcResource             = cloudPcResource;
 }
 internal VirtualApplicationGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string managedBy, string kind, string etag, SystemAssignedServiceIdentity identity, ResourceModelWithAllowedPropertySetSku sku, ArmPlan plan, string objectId, string description, string friendlyName, string hostPoolArmPath, string workspaceArmPath, ApplicationGroupType applicationGroupType, MigrationRequestProperties migrationRequest, bool?cloudPcResource) : base(id, name, resourceType, systemData, tags, location, managedBy, kind, etag, identity, sku, plan)
 {
     ObjectId             = objectId;
     Description          = description;
     FriendlyName         = friendlyName;
     HostPoolArmPath      = hostPoolArmPath;
     WorkspaceArmPath     = workspaceArmPath;
     ApplicationGroupType = applicationGroupType;
     MigrationRequest     = migrationRequest;
     CloudPcResource      = cloudPcResource;
 }
Exemple #16
0
 internal ScalingPlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string managedBy, string kind, string etag, SystemAssignedServiceIdentity identity, ResourceModelWithAllowedPropertySetSku sku, ArmPlan plan, string objectId, string description, string friendlyName, string timeZone, HostPoolType?hostPoolType, string exclusionTag, IList <ScalingSchedule> schedules, IList <ScalingHostPoolReference> hostPoolReferences) : base(id, name, resourceType, systemData, tags, location, managedBy, kind, etag, identity, sku, plan)
 {
     ObjectId           = objectId;
     Description        = description;
     FriendlyName       = friendlyName;
     TimeZone           = timeZone;
     HostPoolType       = hostPoolType;
     ExclusionTag       = exclusionTag;
     Schedules          = schedules;
     HostPoolReferences = hostPoolReferences;
 }