// 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_AuthorizationProviderContractProperties_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 AuthorizationProviderContractProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAuthorizationProviderContractProperties_STATUS, AuthorizationProviderContractProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AuthorizationProviderContractProperties_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 AuthorizationProviderContractProperties_STATUS instances for property testing - lazily instantiated by
// AuthorizationProviderContractProperties_STATUSGenerator()
var authorizationProviderContractProperties_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForAuthorizationProviderContractProperties_STATUS(generators)
	AddRelatedPropertyGeneratorsForAuthorizationProviderContractProperties_STATUS(generators)
	authorizationProviderContractProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(AuthorizationProviderContractProperties_STATUS{}), generators)

	return authorizationProviderContractProperties_STATUSGenerator
}

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

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

func Test_AuthorizationProviderOAuth2GrantTypes_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 AuthorizationProviderOAuth2GrantTypes_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAuthorizationProviderOAuth2GrantTypes_STATUS, AuthorizationProviderOAuth2GrantTypes_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AuthorizationProviderOAuth2GrantTypes_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 AuthorizationProviderOAuth2GrantTypes_STATUS instances for property testing - lazily instantiated by
// AuthorizationProviderOAuth2GrantTypes_STATUSGenerator()
var authorizationProviderOAuth2GrantTypes_STATUSGenerator gopter.Gen

// AuthorizationProviderOAuth2GrantTypes_STATUSGenerator returns a generator of AuthorizationProviderOAuth2GrantTypes_STATUS instances for property testing.
func AuthorizationProviderOAuth2GrantTypes_STATUSGenerator() gopter.Gen {
	if authorizationProviderOAuth2GrantTypes_STATUSGenerator != nil {
		return authorizationProviderOAuth2GrantTypes_STATUSGenerator
	}

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

	return authorizationProviderOAuth2GrantTypes_STATUSGenerator
}

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

func Test_AuthorizationProviderOAuth2Settings_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 AuthorizationProviderOAuth2Settings_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAuthorizationProviderOAuth2Settings_STATUS, AuthorizationProviderOAuth2Settings_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AuthorizationProviderOAuth2Settings_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 AuthorizationProviderOAuth2Settings_STATUS instances for property testing - lazily instantiated by
// AuthorizationProviderOAuth2Settings_STATUSGenerator()
var authorizationProviderOAuth2Settings_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForAuthorizationProviderOAuth2Settings_STATUS(generators)
	AddRelatedPropertyGeneratorsForAuthorizationProviderOAuth2Settings_STATUS(generators)
	authorizationProviderOAuth2Settings_STATUSGenerator = gen.Struct(reflect.TypeOf(AuthorizationProviderOAuth2Settings_STATUS{}), generators)

	return authorizationProviderOAuth2Settings_STATUSGenerator
}

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

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

func Test_AuthorizationProvider_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 AuthorizationProvider_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAuthorizationProvider_STATUS, AuthorizationProvider_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AuthorizationProvider_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 AuthorizationProvider_STATUS instances for property testing - lazily instantiated by
// AuthorizationProvider_STATUSGenerator()
var authorizationProvider_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForAuthorizationProvider_STATUS(generators)
	AddRelatedPropertyGeneratorsForAuthorizationProvider_STATUS(generators)
	authorizationProvider_STATUSGenerator = gen.Struct(reflect.TypeOf(AuthorizationProvider_STATUS{}), generators)

	return authorizationProvider_STATUSGenerator
}

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

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