protected void AddToPSObject(PSObject itemPSObj, ApplicationHealthPolicyMap applicationHealthPolicies)
        {
            if (applicationHealthPolicies == null)
            {
                return;
            }

            var appHealthPolicyMapPSObj = new PSObject(applicationHealthPolicies);

            appHealthPolicyMapPSObj.Members.Add(
                new PSCodeMethod(
                    Constants.ToStringMethodName,
                    typeof(OutputFormatter).GetMethod(Constants.FormatObjectMethodName)));
            itemPSObj.Properties.Add(new PSNoteProperty(Constants.ApplicationHealthPolicyMapPropertyName, appHealthPolicyMapPSObj));
        }
        public void Init()
        {
            var random = new Random((int)DateTime.Now.Ticks);

            FABRIC_SERVICE_TYPE_DESCRIPTION_ = this.random.CreateRandom <ServiceTypeDescription>();
            FABRIC_SERVICE_TYPE_DESCRIPTION_.Extensions.Add("extensionKey1", "extensionValue1");
            FABRIC_SERVICE_TYPE_DESCRIPTION_.Extensions.Add("extensionKey2", "extensionValue2");
            FABRIC_SERVICE_TYPE_DESCRIPTION_.LoadMetrics.Add(random.CreateRandom <ServiceLoadMetricDescription>());
            FABRIC_APPLICATION_DESCRIPTION_ = new ApplicationDescription(
                this.random.CreateRandom <Uri>(),
                this.random.CreateRandom <string>(),
                this.random.CreateRandom <string>());


            FABRIC_APPLICATION_DESCRIPTION_.ApplicationParameters.Add("testParamName", "testValue");
            FABRIC_SERVICE_LOAD_METRIC_DESCRIPTION_ = this.random.CreateRandom <ServiceLoadMetricDescription>();

            FABRIC_SERVICE_GROUP_TYPE_MEMBER_DESCRIPTION_ = this.random.CreateRandom <ServiceGroupTypeMemberDescription>();
            FABRIC_SERVICE_GROUP_TYPE_MEMBER_DESCRIPTION_.LoadMetrics.Add(this.random.CreateRandom <ServiceLoadMetricDescription>());
            FABRIC_SERVICE_GROUP_TYPE_DESCRIPTION_   = this.random.CreateRandom <ServiceGroupTypeDescription>();
            FABRIC_SERVICE_GROUP_MEMBER_DESCRIPTION_ = this.random.CreateRandom <ServiceGroupMemberDescription>();
            FABRIC_SERVICE_GROUP_MEMBER_DESCRIPTION_.InitializationData = new byte[] { 10, 20, 30 };
            FABRIC_PARTITION_SCHEME_    = this.random.CreateRandom <PartitionSchemeDescription>();
            FABRIC_SERVICE_DESCRIPTION_ = this.random.CreateRandom <ServiceDescription>();
            var sf = FABRIC_SERVICE_DESCRIPTION_ as StatefulServiceDescription;

            // If service is not persisted and stateful set properties accordingly.
            if (sf != null)
            {
                // Stateful
                if (sf.HasPersistedState == false)
                {
                    // set these values to null if service is not persisted
                    sf.QuorumLossWaitDuration = sf.ReplicaRestartWaitDuration = sf.StandByReplicaKeepDuration = null;
                }
                else
                {
                    // Persisted
                    // set these values so that sub-seconds part is zero because they will be serialized as seconds and then it can be compared correctly.
                    sf.QuorumLossWaitDuration     = TimeSpan.FromTicks(this.random.Next() * TimeSpan.TicksPerSecond);
                    sf.ReplicaRestartWaitDuration = TimeSpan.FromTicks(this.random.Next() * TimeSpan.TicksPerSecond);
                    sf.StandByReplicaKeepDuration = TimeSpan.FromTicks(this.random.Next() * TimeSpan.TicksPerSecond);
                }
            }

            FABRIC_SERVICE_PLACEMENT_POLICY_DESCRIPTION_ = this.random.CreateRandom <ServicePlacementPolicyDescription>();
            FABRIC_ROLLING_UPGRADE_MONITORING_POLICY_    = this.random.CreateRandom <RollingUpgradeMonitoringPolicy>();

            var appUpgradePolicy = this.random.CreateRandom <MonitoredRollingApplicationUpgradePolicyDescription>();

            appUpgradePolicy.UpgradeMode = RollingUpgradeMode.Monitored;

            FABRIC_APPLICATION_UPGRADE_DESCRIPTION_ = this.random.CreateRandom <ApplicationUpgradeDescription>();
            FABRIC_APPLICATION_UPGRADE_DESCRIPTION_.UpgradePolicyDescription = appUpgradePolicy;

            FABRIC_APPLICATION_UPGRADE_UPDATE_DESCRIPTION_             = this.random.CreateRandom <ApplicationUpgradeUpdateDescription>();
            FABRIC_APPLICATION_UPGRADE_UPDATE_DESCRIPTION_.UpgradeMode = RollingUpgradeMode.Monitored;

            var fabricUpgradePolicy = this.random.CreateRandom <MonitoredRollingFabricUpgradePolicyDescription>();

            fabricUpgradePolicy.UpgradeMode = RollingUpgradeMode.Monitored;
            FABRIC_UPGRADE_DESCRIPTION_     = this.random.CreateRandom <FabricUpgradeDescription>();
            FABRIC_UPGRADE_DESCRIPTION_.UpgradePolicyDescription = fabricUpgradePolicy;

            FABRIC_UPGRADE_UPDATE_DESCRIPTION_             = this.random.CreateRandom <FabricUpgradeUpdateDescription>();
            FABRIC_UPGRADE_UPDATE_DESCRIPTION_.UpgradeMode = RollingUpgradeMode.Monitored;

            FABRIC_SERVICE_TYPE_DESCRIPTION_EXTENSION_ = this.random.CreateRandom <DescriptionExtension>();
            FABRIC_APPLICATION_HEALTH_POLICY_MAP_      = this.random.CreateRandom <ApplicationHealthPolicyMap>();
        }