// 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_ClusterProperties_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 ClusterProperties via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForClusterProperties, ClusterPropertiesGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ClusterProperties
	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 ClusterProperties instances for property testing - lazily instantiated by ClusterPropertiesGenerator()
var clusterPropertiesGenerator gopter.Gen

// ClusterPropertiesGenerator returns a generator of ClusterProperties instances for property testing.
// We first initialize clusterPropertiesGenerator 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 ClusterPropertiesGenerator() gopter.Gen {
	if clusterPropertiesGenerator != nil {
		return clusterPropertiesGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForClusterProperties(generators)
	clusterPropertiesGenerator = gen.Struct(reflect.TypeOf(ClusterProperties{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForClusterProperties(generators)
	AddRelatedPropertyGeneratorsForClusterProperties(generators)
	clusterPropertiesGenerator = gen.Struct(reflect.TypeOf(ClusterProperties{}), generators)

	return clusterPropertiesGenerator
}

// AddIndependentPropertyGeneratorsForClusterProperties is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForClusterProperties(gens map[string]gopter.Gen) {
	gens["HighAvailability"] = gen.PtrOf(gen.OneConstOf(ClusterProperties_HighAvailability_Disabled, ClusterProperties_HighAvailability_Enabled))
	gens["MinimumTlsVersion"] = gen.PtrOf(gen.OneConstOf(ClusterProperties_MinimumTlsVersion_10, ClusterProperties_MinimumTlsVersion_11, ClusterProperties_MinimumTlsVersion_12))
}

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

func Test_ClusterProperties_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 ClusterProperties_Encryption via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForClusterProperties_Encryption, ClusterProperties_EncryptionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ClusterProperties_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 ClusterProperties_Encryption instances for property testing - lazily instantiated by
// ClusterProperties_EncryptionGenerator()
var clusterProperties_EncryptionGenerator gopter.Gen

// ClusterProperties_EncryptionGenerator returns a generator of ClusterProperties_Encryption instances for property testing.
func ClusterProperties_EncryptionGenerator() gopter.Gen {
	if clusterProperties_EncryptionGenerator != nil {
		return clusterProperties_EncryptionGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddRelatedPropertyGeneratorsForClusterProperties_Encryption(generators)
	clusterProperties_EncryptionGenerator = gen.Struct(reflect.TypeOf(ClusterProperties_Encryption{}), generators)

	return clusterProperties_EncryptionGenerator
}

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

func Test_ClusterProperties_Encryption_CustomerManagedKeyEncryption_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 ClusterProperties_Encryption_CustomerManagedKeyEncryption via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForClusterProperties_Encryption_CustomerManagedKeyEncryption, ClusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ClusterProperties_Encryption_CustomerManagedKeyEncryption
	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 ClusterProperties_Encryption_CustomerManagedKeyEncryption instances for property testing - lazily
// instantiated by ClusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator()
var clusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator gopter.Gen

// ClusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator returns a generator of ClusterProperties_Encryption_CustomerManagedKeyEncryption instances for property testing.
// We first initialize clusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator 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 ClusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator() gopter.Gen {
	if clusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator != nil {
		return clusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForClusterProperties_Encryption_CustomerManagedKeyEncryption(generators)
	clusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator = gen.Struct(reflect.TypeOf(ClusterProperties_Encryption_CustomerManagedKeyEncryption{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForClusterProperties_Encryption_CustomerManagedKeyEncryption(generators)
	AddRelatedPropertyGeneratorsForClusterProperties_Encryption_CustomerManagedKeyEncryption(generators)
	clusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator = gen.Struct(reflect.TypeOf(ClusterProperties_Encryption_CustomerManagedKeyEncryption{}), generators)

	return clusterProperties_Encryption_CustomerManagedKeyEncryptionGenerator
}

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

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

func Test_ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity_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 ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity, ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity
	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 ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity instances for
// property testing - lazily instantiated by
// ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator()
var clusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator gopter.Gen

// ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator returns a generator of ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity instances for property testing.
func ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator() gopter.Gen {
	if clusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator != nil {
		return clusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity(generators)
	clusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator = gen.Struct(reflect.TypeOf(ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity{}), generators)

	return clusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentityGenerator
}

// AddIndependentPropertyGeneratorsForClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity(gens map[string]gopter.Gen) {
	gens["IdentityType"] = gen.PtrOf(gen.OneConstOf(ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity_IdentityType_SystemAssignedIdentity, ClusterProperties_Encryption_CustomerManagedKeyEncryption_KeyEncryptionKeyIdentity_IdentityType_UserAssignedIdentity))
	gens["UserAssignedIdentityResourceId"] = gen.PtrOf(gen.AlphaString())
}

func Test_ManagedServiceIdentity_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 ManagedServiceIdentity via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagedServiceIdentity, ManagedServiceIdentityGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ManagedServiceIdentity
	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 ManagedServiceIdentity instances for property testing - lazily instantiated by
// ManagedServiceIdentityGenerator()
var managedServiceIdentityGenerator gopter.Gen

// ManagedServiceIdentityGenerator returns a generator of ManagedServiceIdentity instances for property testing.
// We first initialize managedServiceIdentityGenerator 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 ManagedServiceIdentityGenerator() gopter.Gen {
	if managedServiceIdentityGenerator != nil {
		return managedServiceIdentityGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedServiceIdentity(generators)
	managedServiceIdentityGenerator = gen.Struct(reflect.TypeOf(ManagedServiceIdentity{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedServiceIdentity(generators)
	AddRelatedPropertyGeneratorsForManagedServiceIdentity(generators)
	managedServiceIdentityGenerator = gen.Struct(reflect.TypeOf(ManagedServiceIdentity{}), generators)

	return managedServiceIdentityGenerator
}

// AddIndependentPropertyGeneratorsForManagedServiceIdentity is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForManagedServiceIdentity(gens map[string]gopter.Gen) {
	gens["Type"] = gen.PtrOf(gen.OneConstOf(
		ManagedServiceIdentityType_None,
		ManagedServiceIdentityType_SystemAssigned,
		ManagedServiceIdentityType_SystemAssignedUserAssigned,
		ManagedServiceIdentityType_UserAssigned))
}

// AddRelatedPropertyGeneratorsForManagedServiceIdentity is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForManagedServiceIdentity(gens map[string]gopter.Gen) {
	gens["UserAssignedIdentities"] = gen.MapOf(
		gen.AlphaString(),
		UserAssignedIdentityDetailsGenerator())
}

func Test_RedisEnterprise_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 RedisEnterprise_Spec via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForRedisEnterprise_Spec, RedisEnterprise_SpecGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual RedisEnterprise_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 RedisEnterprise_Spec instances for property testing - lazily instantiated by
// RedisEnterprise_SpecGenerator()
var redisEnterprise_SpecGenerator gopter.Gen

// RedisEnterprise_SpecGenerator returns a generator of RedisEnterprise_Spec instances for property testing.
// We first initialize redisEnterprise_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 RedisEnterprise_SpecGenerator() gopter.Gen {
	if redisEnterprise_SpecGenerator != nil {
		return redisEnterprise_SpecGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForRedisEnterprise_Spec(generators)
	redisEnterprise_SpecGenerator = gen.Struct(reflect.TypeOf(RedisEnterprise_Spec{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForRedisEnterprise_Spec(generators)
	AddRelatedPropertyGeneratorsForRedisEnterprise_Spec(generators)
	redisEnterprise_SpecGenerator = gen.Struct(reflect.TypeOf(RedisEnterprise_Spec{}), generators)

	return redisEnterprise_SpecGenerator
}

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

// AddRelatedPropertyGeneratorsForRedisEnterprise_Spec is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForRedisEnterprise_Spec(gens map[string]gopter.Gen) {
	gens["Identity"] = gen.PtrOf(ManagedServiceIdentityGenerator())
	gens["Properties"] = gen.PtrOf(ClusterPropertiesGenerator())
	gens["Sku"] = gen.PtrOf(SkuGenerator())
}

func Test_Sku_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 Sku via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSku, SkuGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual Sku
	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 Sku instances for property testing - lazily instantiated by SkuGenerator()
var skuGenerator gopter.Gen

// SkuGenerator returns a generator of Sku instances for property testing.
func SkuGenerator() gopter.Gen {
	if skuGenerator != nil {
		return skuGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSku(generators)
	skuGenerator = gen.Struct(reflect.TypeOf(Sku{}), generators)

	return skuGenerator
}

// AddIndependentPropertyGeneratorsForSku is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSku(gens map[string]gopter.Gen) {
	gens["Capacity"] = gen.PtrOf(gen.Int())
	gens["Name"] = gen.PtrOf(gen.OneConstOf(
		Sku_Name_Balanced_B0,
		Sku_Name_Balanced_B1,
		Sku_Name_Balanced_B10,
		Sku_Name_Balanced_B100,
		Sku_Name_Balanced_B1000,
		Sku_Name_Balanced_B150,
		Sku_Name_Balanced_B20,
		Sku_Name_Balanced_B250,
		Sku_Name_Balanced_B3,
		Sku_Name_Balanced_B350,
		Sku_Name_Balanced_B5,
		Sku_Name_Balanced_B50,
		Sku_Name_Balanced_B500,
		Sku_Name_Balanced_B700,
		Sku_Name_ComputeOptimized_X10,
		Sku_Name_ComputeOptimized_X100,
		Sku_Name_ComputeOptimized_X150,
		Sku_Name_ComputeOptimized_X20,
		Sku_Name_ComputeOptimized_X250,
		Sku_Name_ComputeOptimized_X3,
		Sku_Name_ComputeOptimized_X350,
		Sku_Name_ComputeOptimized_X5,
		Sku_Name_ComputeOptimized_X50,
		Sku_Name_ComputeOptimized_X500,
		Sku_Name_ComputeOptimized_X700,
		Sku_Name_EnterpriseFlash_F1500,
		Sku_Name_EnterpriseFlash_F300,
		Sku_Name_EnterpriseFlash_F700,
		Sku_Name_Enterprise_E1,
		Sku_Name_Enterprise_E10,
		Sku_Name_Enterprise_E100,
		Sku_Name_Enterprise_E20,
		Sku_Name_Enterprise_E200,
		Sku_Name_Enterprise_E400,
		Sku_Name_Enterprise_E5,
		Sku_Name_Enterprise_E50,
		Sku_Name_FlashOptimized_A1000,
		Sku_Name_FlashOptimized_A1500,
		Sku_Name_FlashOptimized_A2000,
		Sku_Name_FlashOptimized_A250,
		Sku_Name_FlashOptimized_A4500,
		Sku_Name_FlashOptimized_A500,
		Sku_Name_FlashOptimized_A700,
		Sku_Name_MemoryOptimized_M10,
		Sku_Name_MemoryOptimized_M100,
		Sku_Name_MemoryOptimized_M1000,
		Sku_Name_MemoryOptimized_M150,
		Sku_Name_MemoryOptimized_M1500,
		Sku_Name_MemoryOptimized_M20,
		Sku_Name_MemoryOptimized_M2000,
		Sku_Name_MemoryOptimized_M250,
		Sku_Name_MemoryOptimized_M350,
		Sku_Name_MemoryOptimized_M50,
		Sku_Name_MemoryOptimized_M500,
		Sku_Name_MemoryOptimized_M700))
}

func Test_UserAssignedIdentityDetails_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 UserAssignedIdentityDetails via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForUserAssignedIdentityDetails, UserAssignedIdentityDetailsGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual UserAssignedIdentityDetails
	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 UserAssignedIdentityDetails instances for property testing - lazily instantiated by
// UserAssignedIdentityDetailsGenerator()
var userAssignedIdentityDetailsGenerator gopter.Gen

// UserAssignedIdentityDetailsGenerator returns a generator of UserAssignedIdentityDetails instances for property testing.
func UserAssignedIdentityDetailsGenerator() gopter.Gen {
	if userAssignedIdentityDetailsGenerator != nil {
		return userAssignedIdentityDetailsGenerator
	}

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

	return userAssignedIdentityDetailsGenerator
}
