// 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_AFDDomainHttpsParameters_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 AFDDomainHttpsParameters_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAFDDomainHttpsParameters_STATUS, AFDDomainHttpsParameters_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AFDDomainHttpsParameters_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 AFDDomainHttpsParameters_STATUS instances for property testing - lazily instantiated by
// AFDDomainHttpsParameters_STATUSGenerator()
var afdDomainHttpsParameters_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForAFDDomainHttpsParameters_STATUS(generators)
	AddRelatedPropertyGeneratorsForAFDDomainHttpsParameters_STATUS(generators)
	afdDomainHttpsParameters_STATUSGenerator = gen.Struct(reflect.TypeOf(AFDDomainHttpsParameters_STATUS{}), generators)

	return afdDomainHttpsParameters_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForAFDDomainHttpsParameters_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForAFDDomainHttpsParameters_STATUS(gens map[string]gopter.Gen) {
	gens["CertificateType"] = gen.PtrOf(gen.OneConstOf(AFDDomainHttpsParameters_CertificateType_STATUS_AzureFirstPartyManagedCertificate, AFDDomainHttpsParameters_CertificateType_STATUS_CustomerCertificate, AFDDomainHttpsParameters_CertificateType_STATUS_ManagedCertificate))
	gens["MinimumTlsVersion"] = gen.PtrOf(gen.OneConstOf(AFDDomainHttpsParameters_MinimumTlsVersion_STATUS_TLS10, AFDDomainHttpsParameters_MinimumTlsVersion_STATUS_TLS12))
}

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

func Test_AFDDomainProperties_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 AFDDomainProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAFDDomainProperties_STATUS, AFDDomainProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AFDDomainProperties_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 AFDDomainProperties_STATUS instances for property testing - lazily instantiated by
// AFDDomainProperties_STATUSGenerator()
var afdDomainProperties_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForAFDDomainProperties_STATUS(generators)
	AddRelatedPropertyGeneratorsForAFDDomainProperties_STATUS(generators)
	afdDomainProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(AFDDomainProperties_STATUS{}), generators)

	return afdDomainProperties_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForAFDDomainProperties_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForAFDDomainProperties_STATUS(gens map[string]gopter.Gen) {
	gens["DeploymentStatus"] = gen.PtrOf(gen.OneConstOf(
		AFDDomainProperties_DeploymentStatus_STATUS_Failed,
		AFDDomainProperties_DeploymentStatus_STATUS_InProgress,
		AFDDomainProperties_DeploymentStatus_STATUS_NotStarted,
		AFDDomainProperties_DeploymentStatus_STATUS_Succeeded))
	gens["DomainValidationState"] = gen.PtrOf(gen.OneConstOf(
		AFDDomainProperties_DomainValidationState_STATUS_Approved,
		AFDDomainProperties_DomainValidationState_STATUS_InternalError,
		AFDDomainProperties_DomainValidationState_STATUS_Pending,
		AFDDomainProperties_DomainValidationState_STATUS_PendingRevalidation,
		AFDDomainProperties_DomainValidationState_STATUS_RefreshingValidationToken,
		AFDDomainProperties_DomainValidationState_STATUS_Rejected,
		AFDDomainProperties_DomainValidationState_STATUS_Submitting,
		AFDDomainProperties_DomainValidationState_STATUS_TimedOut,
		AFDDomainProperties_DomainValidationState_STATUS_Unknown))
	gens["ExtendedProperties"] = gen.MapOf(
		gen.AlphaString(),
		gen.AlphaString())
	gens["HostName"] = gen.PtrOf(gen.AlphaString())
	gens["ProfileName"] = gen.PtrOf(gen.AlphaString())
	gens["ProvisioningState"] = gen.PtrOf(gen.OneConstOf(
		AFDDomainProperties_ProvisioningState_STATUS_Creating,
		AFDDomainProperties_ProvisioningState_STATUS_Deleting,
		AFDDomainProperties_ProvisioningState_STATUS_Failed,
		AFDDomainProperties_ProvisioningState_STATUS_Succeeded,
		AFDDomainProperties_ProvisioningState_STATUS_Updating))
}

// AddRelatedPropertyGeneratorsForAFDDomainProperties_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForAFDDomainProperties_STATUS(gens map[string]gopter.Gen) {
	gens["AzureDnsZone"] = gen.PtrOf(ResourceReference_STATUSGenerator())
	gens["PreValidatedCustomDomainResourceId"] = gen.PtrOf(ResourceReference_STATUSGenerator())
	gens["TlsSettings"] = gen.PtrOf(AFDDomainHttpsParameters_STATUSGenerator())
	gens["ValidationProperties"] = gen.PtrOf(DomainValidationProperties_STATUSGenerator())
}

func Test_AfdCustomDomain_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 AfdCustomDomain_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAfdCustomDomain_STATUS, AfdCustomDomain_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AfdCustomDomain_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 AfdCustomDomain_STATUS instances for property testing - lazily instantiated by
// AfdCustomDomain_STATUSGenerator()
var afdCustomDomain_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForAfdCustomDomain_STATUS(generators)
	AddRelatedPropertyGeneratorsForAfdCustomDomain_STATUS(generators)
	afdCustomDomain_STATUSGenerator = gen.Struct(reflect.TypeOf(AfdCustomDomain_STATUS{}), generators)

	return afdCustomDomain_STATUSGenerator
}

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

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

func Test_DomainValidationProperties_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 DomainValidationProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDomainValidationProperties_STATUS, DomainValidationProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual DomainValidationProperties_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 DomainValidationProperties_STATUS instances for property testing - lazily instantiated by
// DomainValidationProperties_STATUSGenerator()
var domainValidationProperties_STATUSGenerator gopter.Gen

// DomainValidationProperties_STATUSGenerator returns a generator of DomainValidationProperties_STATUS instances for property testing.
func DomainValidationProperties_STATUSGenerator() gopter.Gen {
	if domainValidationProperties_STATUSGenerator != nil {
		return domainValidationProperties_STATUSGenerator
	}

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

	return domainValidationProperties_STATUSGenerator
}

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

func Test_ResourceReference_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 ResourceReference_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForResourceReference_STATUS, ResourceReference_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ResourceReference_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 ResourceReference_STATUS instances for property testing - lazily instantiated by
// ResourceReference_STATUSGenerator()
var resourceReference_STATUSGenerator gopter.Gen

// ResourceReference_STATUSGenerator returns a generator of ResourceReference_STATUS instances for property testing.
func ResourceReference_STATUSGenerator() gopter.Gen {
	if resourceReference_STATUSGenerator != nil {
		return resourceReference_STATUSGenerator
	}

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

	return resourceReference_STATUSGenerator
}

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

func Test_SystemData_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 SystemData_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSystemData_STATUS, SystemData_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual SystemData_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 SystemData_STATUS instances for property testing - lazily instantiated by SystemData_STATUSGenerator()
var systemData_STATUSGenerator gopter.Gen

// SystemData_STATUSGenerator returns a generator of SystemData_STATUS instances for property testing.
func SystemData_STATUSGenerator() gopter.Gen {
	if systemData_STATUSGenerator != nil {
		return systemData_STATUSGenerator
	}

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

	return systemData_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForSystemData_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSystemData_STATUS(gens map[string]gopter.Gen) {
	gens["CreatedAt"] = gen.PtrOf(gen.AlphaString())
	gens["CreatedBy"] = gen.PtrOf(gen.AlphaString())
	gens["CreatedByType"] = gen.PtrOf(gen.OneConstOf(
		IdentityType_STATUS_Application,
		IdentityType_STATUS_Key,
		IdentityType_STATUS_ManagedIdentity,
		IdentityType_STATUS_User))
	gens["LastModifiedAt"] = gen.PtrOf(gen.AlphaString())
	gens["LastModifiedBy"] = gen.PtrOf(gen.AlphaString())
	gens["LastModifiedByType"] = gen.PtrOf(gen.OneConstOf(
		IdentityType_STATUS_Application,
		IdentityType_STATUS_Key,
		IdentityType_STATUS_ManagedIdentity,
		IdentityType_STATUS_User))
}
