// 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_NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded_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 NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForNatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded, NatGateway_STATUS_PublicIPPrefix_SubResourceEmbeddedGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// NatGateway_STATUS_PublicIPPrefix_SubResourceEmbeddedGenerator returns a generator of NatGateway_STATUS_PublicIPPrefix_SubResourceEmbedded instances for property testing.
func NatGateway_STATUS_PublicIPPrefix_SubResourceEmbeddedGenerator() gopter.Gen {
	if natGateway_STATUS_PublicIPPrefix_SubResourceEmbeddedGenerator != nil {
		return natGateway_STATUS_PublicIPPrefix_SubResourceEmbeddedGenerator
	}

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

	return natGateway_STATUS_PublicIPPrefix_SubResourceEmbeddedGenerator
}

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

func Test_PublicIPPrefixPropertiesFormat_STATUS_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 PublicIPPrefixPropertiesFormat_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForPublicIPPrefixPropertiesFormat_STATUS, PublicIPPrefixPropertiesFormat_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForPublicIPPrefixPropertiesFormat_STATUS(generators)
	AddRelatedPropertyGeneratorsForPublicIPPrefixPropertiesFormat_STATUS(generators)
	publicIPPrefixPropertiesFormat_STATUSGenerator = gen.Struct(reflect.TypeOf(PublicIPPrefixPropertiesFormat_STATUS{}), generators)

	return publicIPPrefixPropertiesFormat_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForPublicIPPrefixPropertiesFormat_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForPublicIPPrefixPropertiesFormat_STATUS(gens map[string]gopter.Gen) {
	gens["IpPrefix"] = gen.PtrOf(gen.AlphaString())
	gens["PrefixLength"] = gen.PtrOf(gen.Int())
	gens["ProvisioningState"] = gen.PtrOf(gen.OneConstOf(
		ProvisioningState_STATUS_Deleting,
		ProvisioningState_STATUS_Failed,
		ProvisioningState_STATUS_Succeeded,
		ProvisioningState_STATUS_Updating))
	gens["PublicIPAddressVersion"] = gen.PtrOf(gen.OneConstOf(IPVersion_STATUS_IPv4, IPVersion_STATUS_IPv6))
	gens["ResourceGuid"] = gen.PtrOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForPublicIPPrefixPropertiesFormat_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForPublicIPPrefixPropertiesFormat_STATUS(gens map[string]gopter.Gen) {
	gens["CustomIPPrefix"] = gen.PtrOf(SubResource_STATUSGenerator())
	gens["IpTags"] = gen.SliceOf(IpTag_STATUSGenerator())
	gens["LoadBalancerFrontendIpConfiguration"] = gen.PtrOf(SubResource_STATUSGenerator())
	gens["NatGateway"] = gen.PtrOf(NatGateway_STATUS_PublicIPPrefix_SubResourceEmbeddedGenerator())
	gens["PublicIPAddresses"] = gen.SliceOf(ReferencedPublicIpAddress_STATUSGenerator())
}

func Test_PublicIPPrefixSku_STATUS_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 PublicIPPrefixSku_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForPublicIPPrefixSku_STATUS, PublicIPPrefixSku_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// PublicIPPrefixSku_STATUSGenerator returns a generator of PublicIPPrefixSku_STATUS instances for property testing.
func PublicIPPrefixSku_STATUSGenerator() gopter.Gen {
	if publicIPPrefixSku_STATUSGenerator != nil {
		return publicIPPrefixSku_STATUSGenerator
	}

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

	return publicIPPrefixSku_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForPublicIPPrefixSku_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForPublicIPPrefixSku_STATUS(gens map[string]gopter.Gen) {
	gens["Name"] = gen.PtrOf(gen.OneConstOf(PublicIPPrefixSku_Name_STATUS_Standard))
	gens["Tier"] = gen.PtrOf(gen.OneConstOf(PublicIPPrefixSku_Tier_STATUS_Global, PublicIPPrefixSku_Tier_STATUS_Regional))
}

func Test_PublicIPPrefix_STATUS_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 PublicIPPrefix_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForPublicIPPrefix_STATUS, PublicIPPrefix_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForPublicIPPrefix_STATUS(generators)
	AddRelatedPropertyGeneratorsForPublicIPPrefix_STATUS(generators)
	publicIPPrefix_STATUSGenerator = gen.Struct(reflect.TypeOf(PublicIPPrefix_STATUS{}), generators)

	return publicIPPrefix_STATUSGenerator
}

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

// AddRelatedPropertyGeneratorsForPublicIPPrefix_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForPublicIPPrefix_STATUS(gens map[string]gopter.Gen) {
	gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocation_STATUSGenerator())
	gens["Properties"] = gen.PtrOf(PublicIPPrefixPropertiesFormat_STATUSGenerator())
	gens["Sku"] = gen.PtrOf(PublicIPPrefixSku_STATUSGenerator())
}

func Test_ReferencedPublicIpAddress_STATUS_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 ReferencedPublicIpAddress_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForReferencedPublicIpAddress_STATUS, ReferencedPublicIpAddress_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ReferencedPublicIpAddress_STATUSGenerator returns a generator of ReferencedPublicIpAddress_STATUS instances for property testing.
func ReferencedPublicIpAddress_STATUSGenerator() gopter.Gen {
	if referencedPublicIpAddress_STATUSGenerator != nil {
		return referencedPublicIpAddress_STATUSGenerator
	}

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

	return referencedPublicIpAddress_STATUSGenerator
}

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