// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package arm

import (
	"encoding/json"
	"github.com/google/go-cmp/cmp"
	"github.com/google/go-cmp/cmp/cmpopts"
	"github.com/kr/pretty"
	"github.com/kylelemons/godebug/diff"
	"github.com/leanovate/gopter"
	"github.com/leanovate/gopter/gen"
	"github.com/leanovate/gopter/prop"
	"os"
	"reflect"
	"testing"
)

func Test_CreationData_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of CreationData via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForCreationData, CreationDataGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForCreationData runs a test to see if a specific instance of CreationData round trips to JSON and back losslessly
func RunJSONSerializationTestForCreationData(subject CreationData) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual CreationData
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of CreationData instances for property testing - lazily instantiated by CreationDataGenerator()
var creationDataGenerator gopter.Gen

// CreationDataGenerator returns a generator of CreationData instances for property testing.
// We first initialize creationDataGenerator with a simplified generator based on the
// fields with primitive types then replacing it with a more complex one that also handles complex fields
// to ensure any cycles in the object graph properly terminate.
func CreationDataGenerator() gopter.Gen {
	if creationDataGenerator != nil {
		return creationDataGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForCreationData(generators)
	creationDataGenerator = gen.Struct(reflect.TypeOf(CreationData{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForCreationData(generators)
	AddRelatedPropertyGeneratorsForCreationData(generators)
	creationDataGenerator = gen.Struct(reflect.TypeOf(CreationData{}), generators)

	return creationDataGenerator
}

// AddIndependentPropertyGeneratorsForCreationData is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForCreationData(gens map[string]gopter.Gen) {
	gens["CreateOption"] = gen.PtrOf(gen.OneConstOf(
		DiskCreateOption_Attach,
		DiskCreateOption_Copy,
		DiskCreateOption_CopyFromSanSnapshot,
		DiskCreateOption_CopyStart,
		DiskCreateOption_Empty,
		DiskCreateOption_FromImage,
		DiskCreateOption_Import,
		DiskCreateOption_ImportSecure,
		DiskCreateOption_Restore,
		DiskCreateOption_Upload,
		DiskCreateOption_UploadPreparedSecure))
	gens["ElasticSanResourceId"] = gen.PtrOf(gen.AlphaString())
	gens["LogicalSectorSize"] = gen.PtrOf(gen.Int())
	gens["PerformancePlus"] = gen.PtrOf(gen.Bool())
	gens["ProvisionedBandwidthCopySpeed"] = gen.PtrOf(gen.OneConstOf(ProvisionedBandwidthCopyOption_Enhanced, ProvisionedBandwidthCopyOption_None))
	gens["SecurityDataUri"] = gen.PtrOf(gen.AlphaString())
	gens["SourceResourceId"] = gen.PtrOf(gen.AlphaString())
	gens["SourceUri"] = gen.PtrOf(gen.AlphaString())
	gens["StorageAccountId"] = gen.PtrOf(gen.AlphaString())
	gens["UploadSizeBytes"] = gen.PtrOf(gen.Int())
}

// AddRelatedPropertyGeneratorsForCreationData is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForCreationData(gens map[string]gopter.Gen) {
	gens["GalleryImageReference"] = gen.PtrOf(ImageDiskReferenceGenerator())
	gens["ImageReference"] = gen.PtrOf(ImageDiskReferenceGenerator())
}

func Test_DiskProperties_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of DiskProperties via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDiskProperties, DiskPropertiesGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForDiskProperties runs a test to see if a specific instance of DiskProperties round trips to JSON and back losslessly
func RunJSONSerializationTestForDiskProperties(subject DiskProperties) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual DiskProperties
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of DiskProperties instances for property testing - lazily instantiated by DiskPropertiesGenerator()
var diskPropertiesGenerator gopter.Gen

// DiskPropertiesGenerator returns a generator of DiskProperties instances for property testing.
// We first initialize diskPropertiesGenerator with a simplified generator based on the
// fields with primitive types then replacing it with a more complex one that also handles complex fields
// to ensure any cycles in the object graph properly terminate.
func DiskPropertiesGenerator() gopter.Gen {
	if diskPropertiesGenerator != nil {
		return diskPropertiesGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDiskProperties(generators)
	diskPropertiesGenerator = gen.Struct(reflect.TypeOf(DiskProperties{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDiskProperties(generators)
	AddRelatedPropertyGeneratorsForDiskProperties(generators)
	diskPropertiesGenerator = gen.Struct(reflect.TypeOf(DiskProperties{}), generators)

	return diskPropertiesGenerator
}

// AddIndependentPropertyGeneratorsForDiskProperties is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDiskProperties(gens map[string]gopter.Gen) {
	gens["BurstingEnabled"] = gen.PtrOf(gen.Bool())
	gens["CompletionPercent"] = gen.PtrOf(gen.Float64())
	gens["DataAccessAuthMode"] = gen.PtrOf(gen.OneConstOf(DataAccessAuthMode_AzureActiveDirectory, DataAccessAuthMode_None))
	gens["DiskAccessId"] = gen.PtrOf(gen.AlphaString())
	gens["DiskIOPSReadOnly"] = gen.PtrOf(gen.Int())
	gens["DiskIOPSReadWrite"] = gen.PtrOf(gen.Int())
	gens["DiskMBpsReadOnly"] = gen.PtrOf(gen.Int())
	gens["DiskMBpsReadWrite"] = gen.PtrOf(gen.Int())
	gens["DiskSizeGB"] = gen.PtrOf(gen.Int())
	gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(HyperVGeneration_V1, HyperVGeneration_V2))
	gens["MaxShares"] = gen.PtrOf(gen.Int())
	gens["NetworkAccessPolicy"] = gen.PtrOf(gen.OneConstOf(NetworkAccessPolicy_AllowAll, NetworkAccessPolicy_AllowPrivate, NetworkAccessPolicy_DenyAll))
	gens["OptimizedForFrequentAttach"] = gen.PtrOf(gen.Bool())
	gens["OsType"] = gen.PtrOf(gen.OneConstOf(OperatingSystemTypes_Linux, OperatingSystemTypes_Windows))
	gens["PublicNetworkAccess"] = gen.PtrOf(gen.OneConstOf(PublicNetworkAccess_Disabled, PublicNetworkAccess_Enabled))
	gens["SupportsHibernation"] = gen.PtrOf(gen.Bool())
	gens["Tier"] = gen.PtrOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForDiskProperties is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForDiskProperties(gens map[string]gopter.Gen) {
	gens["CreationData"] = gen.PtrOf(CreationDataGenerator())
	gens["Encryption"] = gen.PtrOf(EncryptionGenerator())
	gens["EncryptionSettingsCollection"] = gen.PtrOf(EncryptionSettingsCollectionGenerator())
	gens["PurchasePlan"] = gen.PtrOf(DiskPurchasePlanGenerator())
	gens["SecurityProfile"] = gen.PtrOf(DiskSecurityProfileGenerator())
	gens["SupportedCapabilities"] = gen.PtrOf(SupportedCapabilitiesGenerator())
}

func Test_DiskPurchasePlan_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of DiskPurchasePlan via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDiskPurchasePlan, DiskPurchasePlanGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForDiskPurchasePlan runs a test to see if a specific instance of DiskPurchasePlan round trips to JSON and back losslessly
func RunJSONSerializationTestForDiskPurchasePlan(subject DiskPurchasePlan) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual DiskPurchasePlan
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of DiskPurchasePlan instances for property testing - lazily instantiated by DiskPurchasePlanGenerator()
var diskPurchasePlanGenerator gopter.Gen

// DiskPurchasePlanGenerator returns a generator of DiskPurchasePlan instances for property testing.
func DiskPurchasePlanGenerator() gopter.Gen {
	if diskPurchasePlanGenerator != nil {
		return diskPurchasePlanGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDiskPurchasePlan(generators)
	diskPurchasePlanGenerator = gen.Struct(reflect.TypeOf(DiskPurchasePlan{}), generators)

	return diskPurchasePlanGenerator
}

// AddIndependentPropertyGeneratorsForDiskPurchasePlan is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDiskPurchasePlan(gens map[string]gopter.Gen) {
	gens["Name"] = gen.PtrOf(gen.AlphaString())
	gens["Product"] = gen.PtrOf(gen.AlphaString())
	gens["PromotionCode"] = gen.PtrOf(gen.AlphaString())
	gens["Publisher"] = gen.PtrOf(gen.AlphaString())
}

func Test_DiskSecurityProfile_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of DiskSecurityProfile via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDiskSecurityProfile, DiskSecurityProfileGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForDiskSecurityProfile runs a test to see if a specific instance of DiskSecurityProfile round trips to JSON and back losslessly
func RunJSONSerializationTestForDiskSecurityProfile(subject DiskSecurityProfile) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual DiskSecurityProfile
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of DiskSecurityProfile instances for property testing - lazily instantiated by
// DiskSecurityProfileGenerator()
var diskSecurityProfileGenerator gopter.Gen

// DiskSecurityProfileGenerator returns a generator of DiskSecurityProfile instances for property testing.
func DiskSecurityProfileGenerator() gopter.Gen {
	if diskSecurityProfileGenerator != nil {
		return diskSecurityProfileGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDiskSecurityProfile(generators)
	diskSecurityProfileGenerator = gen.Struct(reflect.TypeOf(DiskSecurityProfile{}), generators)

	return diskSecurityProfileGenerator
}

// AddIndependentPropertyGeneratorsForDiskSecurityProfile is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDiskSecurityProfile(gens map[string]gopter.Gen) {
	gens["SecureVMDiskEncryptionSetId"] = gen.PtrOf(gen.AlphaString())
	gens["SecurityType"] = gen.PtrOf(gen.OneConstOf(
		DiskSecurityTypes_ConfidentialVM_DiskEncryptedWithCustomerKey,
		DiskSecurityTypes_ConfidentialVM_DiskEncryptedWithPlatformKey,
		DiskSecurityTypes_ConfidentialVM_NonPersistedTPM,
		DiskSecurityTypes_ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey,
		DiskSecurityTypes_TrustedLaunch))
}

func Test_DiskSku_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of DiskSku via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDiskSku, DiskSkuGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForDiskSku runs a test to see if a specific instance of DiskSku round trips to JSON and back losslessly
func RunJSONSerializationTestForDiskSku(subject DiskSku) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual DiskSku
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of DiskSku instances for property testing - lazily instantiated by DiskSkuGenerator()
var diskSkuGenerator gopter.Gen

// DiskSkuGenerator returns a generator of DiskSku instances for property testing.
func DiskSkuGenerator() gopter.Gen {
	if diskSkuGenerator != nil {
		return diskSkuGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDiskSku(generators)
	diskSkuGenerator = gen.Struct(reflect.TypeOf(DiskSku{}), generators)

	return diskSkuGenerator
}

// AddIndependentPropertyGeneratorsForDiskSku is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDiskSku(gens map[string]gopter.Gen) {
	gens["Name"] = gen.PtrOf(gen.OneConstOf(
		DiskStorageAccountTypes_PremiumV2_LRS,
		DiskStorageAccountTypes_Premium_LRS,
		DiskStorageAccountTypes_Premium_ZRS,
		DiskStorageAccountTypes_StandardSSD_LRS,
		DiskStorageAccountTypes_StandardSSD_ZRS,
		DiskStorageAccountTypes_Standard_LRS,
		DiskStorageAccountTypes_UltraSSD_LRS))
}

func Test_Disk_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 80
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of Disk_Spec via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDisk_Spec, Disk_SpecGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForDisk_Spec runs a test to see if a specific instance of Disk_Spec round trips to JSON and back losslessly
func RunJSONSerializationTestForDisk_Spec(subject Disk_Spec) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual Disk_Spec
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of Disk_Spec instances for property testing - lazily instantiated by Disk_SpecGenerator()
var disk_SpecGenerator gopter.Gen

// Disk_SpecGenerator returns a generator of Disk_Spec instances for property testing.
// We first initialize disk_SpecGenerator with a simplified generator based on the
// fields with primitive types then replacing it with a more complex one that also handles complex fields
// to ensure any cycles in the object graph properly terminate.
func Disk_SpecGenerator() gopter.Gen {
	if disk_SpecGenerator != nil {
		return disk_SpecGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDisk_Spec(generators)
	disk_SpecGenerator = gen.Struct(reflect.TypeOf(Disk_Spec{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDisk_Spec(generators)
	AddRelatedPropertyGeneratorsForDisk_Spec(generators)
	disk_SpecGenerator = gen.Struct(reflect.TypeOf(Disk_Spec{}), generators)

	return disk_SpecGenerator
}

// AddIndependentPropertyGeneratorsForDisk_Spec is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDisk_Spec(gens map[string]gopter.Gen) {
	gens["Location"] = gen.PtrOf(gen.AlphaString())
	gens["Name"] = gen.AlphaString()
	gens["Tags"] = gen.MapOf(
		gen.AlphaString(),
		gen.AlphaString())
	gens["Zones"] = gen.SliceOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForDisk_Spec is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForDisk_Spec(gens map[string]gopter.Gen) {
	gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationGenerator())
	gens["Properties"] = gen.PtrOf(DiskPropertiesGenerator())
	gens["Sku"] = gen.PtrOf(DiskSkuGenerator())
}

func Test_Encryption_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of Encryption via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForEncryption, EncryptionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForEncryption runs a test to see if a specific instance of Encryption round trips to JSON and back losslessly
func RunJSONSerializationTestForEncryption(subject Encryption) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual Encryption
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of Encryption instances for property testing - lazily instantiated by EncryptionGenerator()
var encryptionGenerator gopter.Gen

// EncryptionGenerator returns a generator of Encryption instances for property testing.
func EncryptionGenerator() gopter.Gen {
	if encryptionGenerator != nil {
		return encryptionGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForEncryption(generators)
	encryptionGenerator = gen.Struct(reflect.TypeOf(Encryption{}), generators)

	return encryptionGenerator
}

// AddIndependentPropertyGeneratorsForEncryption is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForEncryption(gens map[string]gopter.Gen) {
	gens["DiskEncryptionSetId"] = gen.PtrOf(gen.AlphaString())
	gens["Type"] = gen.PtrOf(gen.OneConstOf(EncryptionType_EncryptionAtRestWithCustomerKey, EncryptionType_EncryptionAtRestWithPlatformAndCustomerKeys, EncryptionType_EncryptionAtRestWithPlatformKey))
}

func Test_EncryptionSettingsCollection_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of EncryptionSettingsCollection via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForEncryptionSettingsCollection, EncryptionSettingsCollectionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForEncryptionSettingsCollection runs a test to see if a specific instance of EncryptionSettingsCollection round trips to JSON and back losslessly
func RunJSONSerializationTestForEncryptionSettingsCollection(subject EncryptionSettingsCollection) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual EncryptionSettingsCollection
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of EncryptionSettingsCollection instances for property testing - lazily instantiated by
// EncryptionSettingsCollectionGenerator()
var encryptionSettingsCollectionGenerator gopter.Gen

// EncryptionSettingsCollectionGenerator returns a generator of EncryptionSettingsCollection instances for property testing.
// We first initialize encryptionSettingsCollectionGenerator with a simplified generator based on the
// fields with primitive types then replacing it with a more complex one that also handles complex fields
// to ensure any cycles in the object graph properly terminate.
func EncryptionSettingsCollectionGenerator() gopter.Gen {
	if encryptionSettingsCollectionGenerator != nil {
		return encryptionSettingsCollectionGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForEncryptionSettingsCollection(generators)
	encryptionSettingsCollectionGenerator = gen.Struct(reflect.TypeOf(EncryptionSettingsCollection{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForEncryptionSettingsCollection(generators)
	AddRelatedPropertyGeneratorsForEncryptionSettingsCollection(generators)
	encryptionSettingsCollectionGenerator = gen.Struct(reflect.TypeOf(EncryptionSettingsCollection{}), generators)

	return encryptionSettingsCollectionGenerator
}

// AddIndependentPropertyGeneratorsForEncryptionSettingsCollection is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForEncryptionSettingsCollection(gens map[string]gopter.Gen) {
	gens["Enabled"] = gen.PtrOf(gen.Bool())
	gens["EncryptionSettingsVersion"] = gen.PtrOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForEncryptionSettingsCollection is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForEncryptionSettingsCollection(gens map[string]gopter.Gen) {
	gens["EncryptionSettings"] = gen.SliceOf(EncryptionSettingsElementGenerator())
}

func Test_EncryptionSettingsElement_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of EncryptionSettingsElement via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForEncryptionSettingsElement, EncryptionSettingsElementGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForEncryptionSettingsElement runs a test to see if a specific instance of EncryptionSettingsElement round trips to JSON and back losslessly
func RunJSONSerializationTestForEncryptionSettingsElement(subject EncryptionSettingsElement) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual EncryptionSettingsElement
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of EncryptionSettingsElement instances for property testing - lazily instantiated by
// EncryptionSettingsElementGenerator()
var encryptionSettingsElementGenerator gopter.Gen

// EncryptionSettingsElementGenerator returns a generator of EncryptionSettingsElement instances for property testing.
func EncryptionSettingsElementGenerator() gopter.Gen {
	if encryptionSettingsElementGenerator != nil {
		return encryptionSettingsElementGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddRelatedPropertyGeneratorsForEncryptionSettingsElement(generators)
	encryptionSettingsElementGenerator = gen.Struct(reflect.TypeOf(EncryptionSettingsElement{}), generators)

	return encryptionSettingsElementGenerator
}

// AddRelatedPropertyGeneratorsForEncryptionSettingsElement is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForEncryptionSettingsElement(gens map[string]gopter.Gen) {
	gens["DiskEncryptionKey"] = gen.PtrOf(KeyVaultAndSecretReferenceGenerator())
	gens["KeyEncryptionKey"] = gen.PtrOf(KeyVaultAndKeyReferenceGenerator())
}

func Test_ImageDiskReference_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of ImageDiskReference via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForImageDiskReference, ImageDiskReferenceGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForImageDiskReference runs a test to see if a specific instance of ImageDiskReference round trips to JSON and back losslessly
func RunJSONSerializationTestForImageDiskReference(subject ImageDiskReference) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual ImageDiskReference
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of ImageDiskReference instances for property testing - lazily instantiated by ImageDiskReferenceGenerator()
var imageDiskReferenceGenerator gopter.Gen

// ImageDiskReferenceGenerator returns a generator of ImageDiskReference instances for property testing.
func ImageDiskReferenceGenerator() gopter.Gen {
	if imageDiskReferenceGenerator != nil {
		return imageDiskReferenceGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForImageDiskReference(generators)
	imageDiskReferenceGenerator = gen.Struct(reflect.TypeOf(ImageDiskReference{}), generators)

	return imageDiskReferenceGenerator
}

// AddIndependentPropertyGeneratorsForImageDiskReference is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForImageDiskReference(gens map[string]gopter.Gen) {
	gens["CommunityGalleryImageId"] = gen.PtrOf(gen.AlphaString())
	gens["Id"] = gen.PtrOf(gen.AlphaString())
	gens["Lun"] = gen.PtrOf(gen.Int())
	gens["SharedGalleryImageId"] = gen.PtrOf(gen.AlphaString())
}

func Test_KeyVaultAndKeyReference_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of KeyVaultAndKeyReference via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForKeyVaultAndKeyReference, KeyVaultAndKeyReferenceGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForKeyVaultAndKeyReference runs a test to see if a specific instance of KeyVaultAndKeyReference round trips to JSON and back losslessly
func RunJSONSerializationTestForKeyVaultAndKeyReference(subject KeyVaultAndKeyReference) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual KeyVaultAndKeyReference
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of KeyVaultAndKeyReference instances for property testing - lazily instantiated by
// KeyVaultAndKeyReferenceGenerator()
var keyVaultAndKeyReferenceGenerator gopter.Gen

// KeyVaultAndKeyReferenceGenerator returns a generator of KeyVaultAndKeyReference instances for property testing.
// We first initialize keyVaultAndKeyReferenceGenerator with a simplified generator based on the
// fields with primitive types then replacing it with a more complex one that also handles complex fields
// to ensure any cycles in the object graph properly terminate.
func KeyVaultAndKeyReferenceGenerator() gopter.Gen {
	if keyVaultAndKeyReferenceGenerator != nil {
		return keyVaultAndKeyReferenceGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForKeyVaultAndKeyReference(generators)
	keyVaultAndKeyReferenceGenerator = gen.Struct(reflect.TypeOf(KeyVaultAndKeyReference{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForKeyVaultAndKeyReference(generators)
	AddRelatedPropertyGeneratorsForKeyVaultAndKeyReference(generators)
	keyVaultAndKeyReferenceGenerator = gen.Struct(reflect.TypeOf(KeyVaultAndKeyReference{}), generators)

	return keyVaultAndKeyReferenceGenerator
}

// AddIndependentPropertyGeneratorsForKeyVaultAndKeyReference is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForKeyVaultAndKeyReference(gens map[string]gopter.Gen) {
	gens["KeyUrl"] = gen.PtrOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForKeyVaultAndKeyReference is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForKeyVaultAndKeyReference(gens map[string]gopter.Gen) {
	gens["SourceVault"] = gen.PtrOf(SourceVaultGenerator())
}

func Test_KeyVaultAndSecretReference_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of KeyVaultAndSecretReference via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForKeyVaultAndSecretReference, KeyVaultAndSecretReferenceGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForKeyVaultAndSecretReference runs a test to see if a specific instance of KeyVaultAndSecretReference round trips to JSON and back losslessly
func RunJSONSerializationTestForKeyVaultAndSecretReference(subject KeyVaultAndSecretReference) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual KeyVaultAndSecretReference
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of KeyVaultAndSecretReference instances for property testing - lazily instantiated by
// KeyVaultAndSecretReferenceGenerator()
var keyVaultAndSecretReferenceGenerator gopter.Gen

// KeyVaultAndSecretReferenceGenerator returns a generator of KeyVaultAndSecretReference instances for property testing.
// We first initialize keyVaultAndSecretReferenceGenerator with a simplified generator based on the
// fields with primitive types then replacing it with a more complex one that also handles complex fields
// to ensure any cycles in the object graph properly terminate.
func KeyVaultAndSecretReferenceGenerator() gopter.Gen {
	if keyVaultAndSecretReferenceGenerator != nil {
		return keyVaultAndSecretReferenceGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForKeyVaultAndSecretReference(generators)
	keyVaultAndSecretReferenceGenerator = gen.Struct(reflect.TypeOf(KeyVaultAndSecretReference{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForKeyVaultAndSecretReference(generators)
	AddRelatedPropertyGeneratorsForKeyVaultAndSecretReference(generators)
	keyVaultAndSecretReferenceGenerator = gen.Struct(reflect.TypeOf(KeyVaultAndSecretReference{}), generators)

	return keyVaultAndSecretReferenceGenerator
}

// AddIndependentPropertyGeneratorsForKeyVaultAndSecretReference is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForKeyVaultAndSecretReference(gens map[string]gopter.Gen) {
	gens["SecretUrl"] = gen.PtrOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForKeyVaultAndSecretReference is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForKeyVaultAndSecretReference(gens map[string]gopter.Gen) {
	gens["SourceVault"] = gen.PtrOf(SourceVaultGenerator())
}

func Test_SupportedCapabilities_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 100
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of SupportedCapabilities via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSupportedCapabilities, SupportedCapabilitiesGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

// RunJSONSerializationTestForSupportedCapabilities runs a test to see if a specific instance of SupportedCapabilities round trips to JSON and back losslessly
func RunJSONSerializationTestForSupportedCapabilities(subject SupportedCapabilities) string {
	// Serialize to JSON
	bin, err := json.Marshal(subject)
	if err != nil {
		return err.Error()
	}

	// Deserialize back into memory
	var actual SupportedCapabilities
	err = json.Unmarshal(bin, &actual)
	if err != nil {
		return err.Error()
	}

	// Check for outcome
	match := cmp.Equal(subject, actual, cmpopts.EquateEmpty())
	if !match {
		actualFmt := pretty.Sprint(actual)
		subjectFmt := pretty.Sprint(subject)
		result := diff.Diff(subjectFmt, actualFmt)
		return result
	}

	return ""
}

// Generator of SupportedCapabilities instances for property testing - lazily instantiated by
// SupportedCapabilitiesGenerator()
var supportedCapabilitiesGenerator gopter.Gen

// SupportedCapabilitiesGenerator returns a generator of SupportedCapabilities instances for property testing.
func SupportedCapabilitiesGenerator() gopter.Gen {
	if supportedCapabilitiesGenerator != nil {
		return supportedCapabilitiesGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSupportedCapabilities(generators)
	supportedCapabilitiesGenerator = gen.Struct(reflect.TypeOf(SupportedCapabilities{}), generators)

	return supportedCapabilitiesGenerator
}

// AddIndependentPropertyGeneratorsForSupportedCapabilities is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSupportedCapabilities(gens map[string]gopter.Gen) {
	gens["AcceleratedNetwork"] = gen.PtrOf(gen.Bool())
	gens["Architecture"] = gen.PtrOf(gen.OneConstOf(Architecture_Arm64, Architecture_X64))
	gens["DiskControllerTypes"] = gen.PtrOf(gen.AlphaString())
}
