// 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_DateAfterCreation_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 DateAfterCreation via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDateAfterCreation, DateAfterCreationGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// DateAfterCreationGenerator returns a generator of DateAfterCreation instances for property testing.
func DateAfterCreationGenerator() gopter.Gen {
	if dateAfterCreationGenerator != nil {
		return dateAfterCreationGenerator
	}

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

	return dateAfterCreationGenerator
}

// AddIndependentPropertyGeneratorsForDateAfterCreation is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDateAfterCreation(gens map[string]gopter.Gen) {
	gens["DaysAfterCreationGreaterThan"] = gen.PtrOf(gen.Int())
	gens["DaysAfterLastTierChangeGreaterThan"] = gen.PtrOf(gen.Int())
}

func Test_DateAfterModification_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 DateAfterModification via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDateAfterModification, DateAfterModificationGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// DateAfterModificationGenerator returns a generator of DateAfterModification instances for property testing.
func DateAfterModificationGenerator() gopter.Gen {
	if dateAfterModificationGenerator != nil {
		return dateAfterModificationGenerator
	}

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

	return dateAfterModificationGenerator
}

// AddIndependentPropertyGeneratorsForDateAfterModification is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDateAfterModification(gens map[string]gopter.Gen) {
	gens["DaysAfterCreationGreaterThan"] = gen.PtrOf(gen.Int())
	gens["DaysAfterLastAccessTimeGreaterThan"] = gen.PtrOf(gen.Int())
	gens["DaysAfterLastTierChangeGreaterThan"] = gen.PtrOf(gen.Int())
	gens["DaysAfterModificationGreaterThan"] = gen.PtrOf(gen.Int())
}

func Test_ManagementPolicyAction_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 ManagementPolicyAction via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicyAction, ManagementPolicyActionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ManagementPolicyActionGenerator returns a generator of ManagementPolicyAction instances for property testing.
func ManagementPolicyActionGenerator() gopter.Gen {
	if managementPolicyActionGenerator != nil {
		return managementPolicyActionGenerator
	}

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

	return managementPolicyActionGenerator
}

// AddRelatedPropertyGeneratorsForManagementPolicyAction is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForManagementPolicyAction(gens map[string]gopter.Gen) {
	gens["BaseBlob"] = gen.PtrOf(ManagementPolicyBaseBlobGenerator())
	gens["Snapshot"] = gen.PtrOf(ManagementPolicySnapShotGenerator())
	gens["Version"] = gen.PtrOf(ManagementPolicyVersionGenerator())
}

func Test_ManagementPolicyBaseBlob_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 ManagementPolicyBaseBlob via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicyBaseBlob, ManagementPolicyBaseBlobGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagementPolicyBaseBlob(generators)
	AddRelatedPropertyGeneratorsForManagementPolicyBaseBlob(generators)
	managementPolicyBaseBlobGenerator = gen.Struct(reflect.TypeOf(ManagementPolicyBaseBlob{}), generators)

	return managementPolicyBaseBlobGenerator
}

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

// AddRelatedPropertyGeneratorsForManagementPolicyBaseBlob is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForManagementPolicyBaseBlob(gens map[string]gopter.Gen) {
	gens["Delete"] = gen.PtrOf(DateAfterModificationGenerator())
	gens["TierToArchive"] = gen.PtrOf(DateAfterModificationGenerator())
	gens["TierToCold"] = gen.PtrOf(DateAfterModificationGenerator())
	gens["TierToCool"] = gen.PtrOf(DateAfterModificationGenerator())
	gens["TierToHot"] = gen.PtrOf(DateAfterModificationGenerator())
}

func Test_ManagementPolicyDefinition_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 ManagementPolicyDefinition via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicyDefinition, ManagementPolicyDefinitionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ManagementPolicyDefinitionGenerator returns a generator of ManagementPolicyDefinition instances for property testing.
func ManagementPolicyDefinitionGenerator() gopter.Gen {
	if managementPolicyDefinitionGenerator != nil {
		return managementPolicyDefinitionGenerator
	}

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

	return managementPolicyDefinitionGenerator
}

// AddRelatedPropertyGeneratorsForManagementPolicyDefinition is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForManagementPolicyDefinition(gens map[string]gopter.Gen) {
	gens["Actions"] = gen.PtrOf(ManagementPolicyActionGenerator())
	gens["Filters"] = gen.PtrOf(ManagementPolicyFilterGenerator())
}

func Test_ManagementPolicyFilter_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 ManagementPolicyFilter via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicyFilter, ManagementPolicyFilterGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagementPolicyFilter(generators)
	AddRelatedPropertyGeneratorsForManagementPolicyFilter(generators)
	managementPolicyFilterGenerator = gen.Struct(reflect.TypeOf(ManagementPolicyFilter{}), generators)

	return managementPolicyFilterGenerator
}

// AddIndependentPropertyGeneratorsForManagementPolicyFilter is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForManagementPolicyFilter(gens map[string]gopter.Gen) {
	gens["BlobTypes"] = gen.SliceOf(gen.AlphaString())
	gens["PrefixMatch"] = gen.SliceOf(gen.AlphaString())
}

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

func Test_ManagementPolicyProperties_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 ManagementPolicyProperties via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicyProperties, ManagementPolicyPropertiesGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ManagementPolicyPropertiesGenerator returns a generator of ManagementPolicyProperties instances for property testing.
func ManagementPolicyPropertiesGenerator() gopter.Gen {
	if managementPolicyPropertiesGenerator != nil {
		return managementPolicyPropertiesGenerator
	}

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

	return managementPolicyPropertiesGenerator
}

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

func Test_ManagementPolicyRule_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 ManagementPolicyRule via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicyRule, ManagementPolicyRuleGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagementPolicyRule(generators)
	AddRelatedPropertyGeneratorsForManagementPolicyRule(generators)
	managementPolicyRuleGenerator = gen.Struct(reflect.TypeOf(ManagementPolicyRule{}), generators)

	return managementPolicyRuleGenerator
}

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

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

func Test_ManagementPolicySchema_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 ManagementPolicySchema via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicySchema, ManagementPolicySchemaGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ManagementPolicySchemaGenerator returns a generator of ManagementPolicySchema instances for property testing.
func ManagementPolicySchemaGenerator() gopter.Gen {
	if managementPolicySchemaGenerator != nil {
		return managementPolicySchemaGenerator
	}

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

	return managementPolicySchemaGenerator
}

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

func Test_ManagementPolicySnapShot_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 ManagementPolicySnapShot via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicySnapShot, ManagementPolicySnapShotGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ManagementPolicySnapShotGenerator returns a generator of ManagementPolicySnapShot instances for property testing.
func ManagementPolicySnapShotGenerator() gopter.Gen {
	if managementPolicySnapShotGenerator != nil {
		return managementPolicySnapShotGenerator
	}

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

	return managementPolicySnapShotGenerator
}

// AddRelatedPropertyGeneratorsForManagementPolicySnapShot is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForManagementPolicySnapShot(gens map[string]gopter.Gen) {
	gens["Delete"] = gen.PtrOf(DateAfterCreationGenerator())
	gens["TierToArchive"] = gen.PtrOf(DateAfterCreationGenerator())
	gens["TierToCold"] = gen.PtrOf(DateAfterCreationGenerator())
	gens["TierToCool"] = gen.PtrOf(DateAfterCreationGenerator())
	gens["TierToHot"] = gen.PtrOf(DateAfterCreationGenerator())
}

func Test_ManagementPolicyVersion_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 ManagementPolicyVersion via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagementPolicyVersion, ManagementPolicyVersionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ManagementPolicyVersionGenerator returns a generator of ManagementPolicyVersion instances for property testing.
func ManagementPolicyVersionGenerator() gopter.Gen {
	if managementPolicyVersionGenerator != nil {
		return managementPolicyVersionGenerator
	}

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

	return managementPolicyVersionGenerator
}

// AddRelatedPropertyGeneratorsForManagementPolicyVersion is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForManagementPolicyVersion(gens map[string]gopter.Gen) {
	gens["Delete"] = gen.PtrOf(DateAfterCreationGenerator())
	gens["TierToArchive"] = gen.PtrOf(DateAfterCreationGenerator())
	gens["TierToCold"] = gen.PtrOf(DateAfterCreationGenerator())
	gens["TierToCool"] = gen.PtrOf(DateAfterCreationGenerator())
	gens["TierToHot"] = gen.PtrOf(DateAfterCreationGenerator())
}

func Test_StorageAccountsManagementPolicy_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 StorageAccountsManagementPolicy_Spec via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForStorageAccountsManagementPolicy_Spec, StorageAccountsManagementPolicy_SpecGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual StorageAccountsManagementPolicy_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 StorageAccountsManagementPolicy_Spec instances for property testing - lazily instantiated by
// StorageAccountsManagementPolicy_SpecGenerator()
var storageAccountsManagementPolicy_SpecGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForStorageAccountsManagementPolicy_Spec(generators)
	AddRelatedPropertyGeneratorsForStorageAccountsManagementPolicy_Spec(generators)
	storageAccountsManagementPolicy_SpecGenerator = gen.Struct(reflect.TypeOf(StorageAccountsManagementPolicy_Spec{}), generators)

	return storageAccountsManagementPolicy_SpecGenerator
}

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

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

func Test_TagFilter_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 TagFilter via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForTagFilter, TagFilterGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// TagFilterGenerator returns a generator of TagFilter instances for property testing.
func TagFilterGenerator() gopter.Gen {
	if tagFilterGenerator != nil {
		return tagFilterGenerator
	}

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

	return tagFilterGenerator
}

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