// 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_CustomRule_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 CustomRule via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForCustomRule, CustomRuleGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForCustomRule(generators)
	customRuleGenerator = gen.Struct(reflect.TypeOf(CustomRule{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForCustomRule(generators)
	AddRelatedPropertyGeneratorsForCustomRule(generators)
	customRuleGenerator = gen.Struct(reflect.TypeOf(CustomRule{}), generators)

	return customRuleGenerator
}

// AddIndependentPropertyGeneratorsForCustomRule is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForCustomRule(gens map[string]gopter.Gen) {
	gens["Action"] = gen.PtrOf(gen.OneConstOf(
		ActionType_Allow,
		ActionType_AnomalyScoring,
		ActionType_Block,
		ActionType_Log,
		ActionType_Redirect))
	gens["EnabledState"] = gen.PtrOf(gen.OneConstOf(CustomRule_EnabledState_Disabled, CustomRule_EnabledState_Enabled))
	gens["Name"] = gen.PtrOf(gen.AlphaString())
	gens["Priority"] = gen.PtrOf(gen.Int())
	gens["RateLimitDurationInMinutes"] = gen.PtrOf(gen.Int())
	gens["RateLimitThreshold"] = gen.PtrOf(gen.Int())
	gens["RuleType"] = gen.PtrOf(gen.OneConstOf(CustomRule_RuleType_MatchRule, CustomRule_RuleType_RateLimitRule))
}

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

func Test_CustomRuleList_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 CustomRuleList via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForCustomRuleList, CustomRuleListGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// CustomRuleListGenerator returns a generator of CustomRuleList instances for property testing.
func CustomRuleListGenerator() gopter.Gen {
	if customRuleListGenerator != nil {
		return customRuleListGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddRelatedPropertyGeneratorsForCustomRuleList(generators)
	customRuleListGenerator = gen.Struct(reflect.TypeOf(CustomRuleList{}), generators)

	return customRuleListGenerator
}

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

func Test_ManagedRuleExclusion_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 ManagedRuleExclusion via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagedRuleExclusion, ManagedRuleExclusionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ManagedRuleExclusionGenerator returns a generator of ManagedRuleExclusion instances for property testing.
func ManagedRuleExclusionGenerator() gopter.Gen {
	if managedRuleExclusionGenerator != nil {
		return managedRuleExclusionGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedRuleExclusion(generators)
	managedRuleExclusionGenerator = gen.Struct(reflect.TypeOf(ManagedRuleExclusion{}), generators)

	return managedRuleExclusionGenerator
}

// AddIndependentPropertyGeneratorsForManagedRuleExclusion is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForManagedRuleExclusion(gens map[string]gopter.Gen) {
	gens["MatchVariable"] = gen.PtrOf(gen.OneConstOf(
		ManagedRuleExclusion_MatchVariable_QueryStringArgNames,
		ManagedRuleExclusion_MatchVariable_RequestBodyJsonArgNames,
		ManagedRuleExclusion_MatchVariable_RequestBodyPostArgNames,
		ManagedRuleExclusion_MatchVariable_RequestCookieNames,
		ManagedRuleExclusion_MatchVariable_RequestHeaderNames))
	gens["Selector"] = gen.PtrOf(gen.AlphaString())
	gens["SelectorMatchOperator"] = gen.PtrOf(gen.OneConstOf(
		ManagedRuleExclusion_SelectorMatchOperator_Contains,
		ManagedRuleExclusion_SelectorMatchOperator_EndsWith,
		ManagedRuleExclusion_SelectorMatchOperator_Equals,
		ManagedRuleExclusion_SelectorMatchOperator_EqualsAny,
		ManagedRuleExclusion_SelectorMatchOperator_StartsWith))
}

func Test_ManagedRuleGroupOverride_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 ManagedRuleGroupOverride via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagedRuleGroupOverride, ManagedRuleGroupOverrideGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedRuleGroupOverride(generators)
	managedRuleGroupOverrideGenerator = gen.Struct(reflect.TypeOf(ManagedRuleGroupOverride{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedRuleGroupOverride(generators)
	AddRelatedPropertyGeneratorsForManagedRuleGroupOverride(generators)
	managedRuleGroupOverrideGenerator = gen.Struct(reflect.TypeOf(ManagedRuleGroupOverride{}), generators)

	return managedRuleGroupOverrideGenerator
}

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

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

func Test_ManagedRuleOverride_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 ManagedRuleOverride via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagedRuleOverride, ManagedRuleOverrideGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedRuleOverride(generators)
	managedRuleOverrideGenerator = gen.Struct(reflect.TypeOf(ManagedRuleOverride{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedRuleOverride(generators)
	AddRelatedPropertyGeneratorsForManagedRuleOverride(generators)
	managedRuleOverrideGenerator = gen.Struct(reflect.TypeOf(ManagedRuleOverride{}), generators)

	return managedRuleOverrideGenerator
}

// AddIndependentPropertyGeneratorsForManagedRuleOverride is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForManagedRuleOverride(gens map[string]gopter.Gen) {
	gens["Action"] = gen.PtrOf(gen.OneConstOf(
		ActionType_Allow,
		ActionType_AnomalyScoring,
		ActionType_Block,
		ActionType_Log,
		ActionType_Redirect))
	gens["EnabledState"] = gen.PtrOf(gen.OneConstOf(ManagedRuleEnabledState_Disabled, ManagedRuleEnabledState_Enabled))
	gens["RuleId"] = gen.PtrOf(gen.AlphaString())
}

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

func Test_ManagedRuleSet_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 ManagedRuleSet via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagedRuleSet, ManagedRuleSetGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedRuleSet(generators)
	managedRuleSetGenerator = gen.Struct(reflect.TypeOf(ManagedRuleSet{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForManagedRuleSet(generators)
	AddRelatedPropertyGeneratorsForManagedRuleSet(generators)
	managedRuleSetGenerator = gen.Struct(reflect.TypeOf(ManagedRuleSet{}), generators)

	return managedRuleSetGenerator
}

// AddIndependentPropertyGeneratorsForManagedRuleSet is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForManagedRuleSet(gens map[string]gopter.Gen) {
	gens["RuleSetAction"] = gen.PtrOf(gen.OneConstOf(ManagedRuleSetActionType_Block, ManagedRuleSetActionType_Log, ManagedRuleSetActionType_Redirect))
	gens["RuleSetType"] = gen.PtrOf(gen.AlphaString())
	gens["RuleSetVersion"] = gen.PtrOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForManagedRuleSet is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForManagedRuleSet(gens map[string]gopter.Gen) {
	gens["Exclusions"] = gen.SliceOf(ManagedRuleExclusionGenerator())
	gens["RuleGroupOverrides"] = gen.SliceOf(ManagedRuleGroupOverrideGenerator())
}

func Test_ManagedRuleSetList_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 ManagedRuleSetList via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForManagedRuleSetList, ManagedRuleSetListGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ManagedRuleSetListGenerator returns a generator of ManagedRuleSetList instances for property testing.
func ManagedRuleSetListGenerator() gopter.Gen {
	if managedRuleSetListGenerator != nil {
		return managedRuleSetListGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddRelatedPropertyGeneratorsForManagedRuleSetList(generators)
	managedRuleSetListGenerator = gen.Struct(reflect.TypeOf(ManagedRuleSetList{}), generators)

	return managedRuleSetListGenerator
}

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

func Test_MatchCondition_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 MatchCondition via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForMatchCondition, MatchConditionGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// MatchConditionGenerator returns a generator of MatchCondition instances for property testing.
func MatchConditionGenerator() gopter.Gen {
	if matchConditionGenerator != nil {
		return matchConditionGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForMatchCondition(generators)
	matchConditionGenerator = gen.Struct(reflect.TypeOf(MatchCondition{}), generators)

	return matchConditionGenerator
}

// AddIndependentPropertyGeneratorsForMatchCondition is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForMatchCondition(gens map[string]gopter.Gen) {
	gens["MatchValue"] = gen.SliceOf(gen.AlphaString())
	gens["MatchVariable"] = gen.PtrOf(gen.OneConstOf(
		MatchCondition_MatchVariable_Cookies,
		MatchCondition_MatchVariable_PostArgs,
		MatchCondition_MatchVariable_QueryString,
		MatchCondition_MatchVariable_RemoteAddr,
		MatchCondition_MatchVariable_RequestBody,
		MatchCondition_MatchVariable_RequestHeader,
		MatchCondition_MatchVariable_RequestMethod,
		MatchCondition_MatchVariable_RequestUri,
		MatchCondition_MatchVariable_SocketAddr))
	gens["NegateCondition"] = gen.PtrOf(gen.Bool())
	gens["Operator"] = gen.PtrOf(gen.OneConstOf(
		MatchCondition_Operator_Any,
		MatchCondition_Operator_BeginsWith,
		MatchCondition_Operator_Contains,
		MatchCondition_Operator_EndsWith,
		MatchCondition_Operator_Equal,
		MatchCondition_Operator_GeoMatch,
		MatchCondition_Operator_GreaterThan,
		MatchCondition_Operator_GreaterThanOrEqual,
		MatchCondition_Operator_IPMatch,
		MatchCondition_Operator_LessThan,
		MatchCondition_Operator_LessThanOrEqual,
		MatchCondition_Operator_RegEx))
	gens["Selector"] = gen.PtrOf(gen.AlphaString())
	gens["Transforms"] = gen.SliceOf(gen.OneConstOf(
		TransformType_Lowercase,
		TransformType_RemoveNulls,
		TransformType_Trim,
		TransformType_Uppercase,
		TransformType_UrlDecode,
		TransformType_UrlEncode))
}

func Test_PolicySettings_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 PolicySettings via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForPolicySettings, PolicySettingsGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// PolicySettingsGenerator returns a generator of PolicySettings instances for property testing.
func PolicySettingsGenerator() gopter.Gen {
	if policySettingsGenerator != nil {
		return policySettingsGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForPolicySettings(generators)
	policySettingsGenerator = gen.Struct(reflect.TypeOf(PolicySettings{}), generators)

	return policySettingsGenerator
}

// AddIndependentPropertyGeneratorsForPolicySettings is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForPolicySettings(gens map[string]gopter.Gen) {
	gens["CustomBlockResponseBody"] = gen.PtrOf(gen.AlphaString())
	gens["CustomBlockResponseStatusCode"] = gen.PtrOf(gen.Int())
	gens["EnabledState"] = gen.PtrOf(gen.OneConstOf(PolicySettings_EnabledState_Disabled, PolicySettings_EnabledState_Enabled))
	gens["Mode"] = gen.PtrOf(gen.OneConstOf(PolicySettings_Mode_Detection, PolicySettings_Mode_Prevention))
	gens["RedirectUrl"] = gen.PtrOf(gen.AlphaString())
	gens["RequestBodyCheck"] = gen.PtrOf(gen.OneConstOf(PolicySettings_RequestBodyCheck_Disabled, PolicySettings_RequestBodyCheck_Enabled))
}

func Test_Sku_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 Sku via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSku, SkuGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// SkuGenerator returns a generator of Sku instances for property testing.
func SkuGenerator() gopter.Gen {
	if skuGenerator != nil {
		return skuGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSku(generators)
	skuGenerator = gen.Struct(reflect.TypeOf(Sku{}), generators)

	return skuGenerator
}

// AddIndependentPropertyGeneratorsForSku is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSku(gens map[string]gopter.Gen) {
	gens["Name"] = gen.PtrOf(gen.OneConstOf(Sku_Name_Classic_AzureFrontDoor, Sku_Name_Premium_AzureFrontDoor, Sku_Name_Standard_AzureFrontDoor))
}

func Test_WebApplicationFirewallPolicyProperties_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 WebApplicationFirewallPolicyProperties via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForWebApplicationFirewallPolicyProperties, WebApplicationFirewallPolicyPropertiesGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// WebApplicationFirewallPolicyPropertiesGenerator returns a generator of WebApplicationFirewallPolicyProperties instances for property testing.
func WebApplicationFirewallPolicyPropertiesGenerator() gopter.Gen {
	if webApplicationFirewallPolicyPropertiesGenerator != nil {
		return webApplicationFirewallPolicyPropertiesGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddRelatedPropertyGeneratorsForWebApplicationFirewallPolicyProperties(generators)
	webApplicationFirewallPolicyPropertiesGenerator = gen.Struct(reflect.TypeOf(WebApplicationFirewallPolicyProperties{}), generators)

	return webApplicationFirewallPolicyPropertiesGenerator
}

// AddRelatedPropertyGeneratorsForWebApplicationFirewallPolicyProperties is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForWebApplicationFirewallPolicyProperties(gens map[string]gopter.Gen) {
	gens["CustomRules"] = gen.PtrOf(CustomRuleListGenerator())
	gens["ManagedRules"] = gen.PtrOf(ManagedRuleSetListGenerator())
	gens["PolicySettings"] = gen.PtrOf(PolicySettingsGenerator())
}

func Test_WebApplicationFirewallPolicy_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 WebApplicationFirewallPolicy_Spec via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForWebApplicationFirewallPolicy_Spec, WebApplicationFirewallPolicy_SpecGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual WebApplicationFirewallPolicy_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 WebApplicationFirewallPolicy_Spec instances for property testing - lazily instantiated by
// WebApplicationFirewallPolicy_SpecGenerator()
var webApplicationFirewallPolicy_SpecGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForWebApplicationFirewallPolicy_Spec(generators)
	webApplicationFirewallPolicy_SpecGenerator = gen.Struct(reflect.TypeOf(WebApplicationFirewallPolicy_Spec{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForWebApplicationFirewallPolicy_Spec(generators)
	AddRelatedPropertyGeneratorsForWebApplicationFirewallPolicy_Spec(generators)
	webApplicationFirewallPolicy_SpecGenerator = gen.Struct(reflect.TypeOf(WebApplicationFirewallPolicy_Spec{}), generators)

	return webApplicationFirewallPolicy_SpecGenerator
}

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

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