// 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_EndpointProperties_CustomHeaders_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 EndpointProperties_CustomHeaders_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForEndpointProperties_CustomHeaders_STATUS, EndpointProperties_CustomHeaders_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual EndpointProperties_CustomHeaders_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 EndpointProperties_CustomHeaders_STATUS instances for property testing - lazily instantiated by
// EndpointProperties_CustomHeaders_STATUSGenerator()
var endpointProperties_CustomHeaders_STATUSGenerator gopter.Gen

// EndpointProperties_CustomHeaders_STATUSGenerator returns a generator of EndpointProperties_CustomHeaders_STATUS instances for property testing.
func EndpointProperties_CustomHeaders_STATUSGenerator() gopter.Gen {
	if endpointProperties_CustomHeaders_STATUSGenerator != nil {
		return endpointProperties_CustomHeaders_STATUSGenerator
	}

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

	return endpointProperties_CustomHeaders_STATUSGenerator
}

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

func Test_EndpointProperties_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 EndpointProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForEndpointProperties_STATUS, EndpointProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual EndpointProperties_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 EndpointProperties_STATUS instances for property testing - lazily instantiated by
// EndpointProperties_STATUSGenerator()
var endpointProperties_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForEndpointProperties_STATUS(generators)
	AddRelatedPropertyGeneratorsForEndpointProperties_STATUS(generators)
	endpointProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(EndpointProperties_STATUS{}), generators)

	return endpointProperties_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForEndpointProperties_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForEndpointProperties_STATUS(gens map[string]gopter.Gen) {
	gens["AlwaysServe"] = gen.PtrOf(gen.OneConstOf(EndpointProperties_AlwaysServe_STATUS_Disabled, EndpointProperties_AlwaysServe_STATUS_Enabled))
	gens["EndpointLocation"] = gen.PtrOf(gen.AlphaString())
	gens["EndpointMonitorStatus"] = gen.PtrOf(gen.OneConstOf(
		EndpointProperties_EndpointMonitorStatus_STATUS_CheckingEndpoint,
		EndpointProperties_EndpointMonitorStatus_STATUS_Degraded,
		EndpointProperties_EndpointMonitorStatus_STATUS_Disabled,
		EndpointProperties_EndpointMonitorStatus_STATUS_Inactive,
		EndpointProperties_EndpointMonitorStatus_STATUS_Online,
		EndpointProperties_EndpointMonitorStatus_STATUS_Stopped,
		EndpointProperties_EndpointMonitorStatus_STATUS_Unmonitored))
	gens["EndpointStatus"] = gen.PtrOf(gen.OneConstOf(EndpointProperties_EndpointStatus_STATUS_Disabled, EndpointProperties_EndpointStatus_STATUS_Enabled))
	gens["GeoMapping"] = gen.SliceOf(gen.AlphaString())
	gens["MinChildEndpoints"] = gen.PtrOf(gen.Int())
	gens["MinChildEndpointsIPv4"] = gen.PtrOf(gen.Int())
	gens["MinChildEndpointsIPv6"] = gen.PtrOf(gen.Int())
	gens["Priority"] = gen.PtrOf(gen.Int())
	gens["Target"] = gen.PtrOf(gen.AlphaString())
	gens["TargetResourceId"] = gen.PtrOf(gen.AlphaString())
	gens["Weight"] = gen.PtrOf(gen.Int())
}

// AddRelatedPropertyGeneratorsForEndpointProperties_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForEndpointProperties_STATUS(gens map[string]gopter.Gen) {
	gens["CustomHeaders"] = gen.SliceOf(EndpointProperties_CustomHeaders_STATUSGenerator())
	gens["Subnets"] = gen.SliceOf(EndpointProperties_Subnets_STATUSGenerator())
}

func Test_EndpointProperties_Subnets_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 EndpointProperties_Subnets_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForEndpointProperties_Subnets_STATUS, EndpointProperties_Subnets_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual EndpointProperties_Subnets_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 EndpointProperties_Subnets_STATUS instances for property testing - lazily instantiated by
// EndpointProperties_Subnets_STATUSGenerator()
var endpointProperties_Subnets_STATUSGenerator gopter.Gen

// EndpointProperties_Subnets_STATUSGenerator returns a generator of EndpointProperties_Subnets_STATUS instances for property testing.
func EndpointProperties_Subnets_STATUSGenerator() gopter.Gen {
	if endpointProperties_Subnets_STATUSGenerator != nil {
		return endpointProperties_Subnets_STATUSGenerator
	}

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

	return endpointProperties_Subnets_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForEndpointProperties_Subnets_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForEndpointProperties_Subnets_STATUS(gens map[string]gopter.Gen) {
	gens["First"] = gen.PtrOf(gen.AlphaString())
	gens["Last"] = gen.PtrOf(gen.AlphaString())
	gens["Scope"] = gen.PtrOf(gen.Int())
}

func Test_TrafficManagerProfilesAzureEndpoint_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 TrafficManagerProfilesAzureEndpoint_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForTrafficManagerProfilesAzureEndpoint_STATUS, TrafficManagerProfilesAzureEndpoint_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual TrafficManagerProfilesAzureEndpoint_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 TrafficManagerProfilesAzureEndpoint_STATUS instances for property testing - lazily instantiated by
// TrafficManagerProfilesAzureEndpoint_STATUSGenerator()
var trafficManagerProfilesAzureEndpoint_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForTrafficManagerProfilesAzureEndpoint_STATUS(generators)
	AddRelatedPropertyGeneratorsForTrafficManagerProfilesAzureEndpoint_STATUS(generators)
	trafficManagerProfilesAzureEndpoint_STATUSGenerator = gen.Struct(reflect.TypeOf(TrafficManagerProfilesAzureEndpoint_STATUS{}), generators)

	return trafficManagerProfilesAzureEndpoint_STATUSGenerator
}

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

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