// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package storage

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_ActionGroupsInformation_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 ActionGroupsInformation via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForActionGroupsInformation, ActionGroupsInformationGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ActionGroupsInformationGenerator returns a generator of ActionGroupsInformation instances for property testing.
func ActionGroupsInformationGenerator() gopter.Gen {
	if actionGroupsInformationGenerator != nil {
		return actionGroupsInformationGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForActionGroupsInformation(generators)
	actionGroupsInformationGenerator = gen.Struct(reflect.TypeOf(ActionGroupsInformation{}), generators)

	return actionGroupsInformationGenerator
}

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

func Test_ActionGroupsInformation_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 ActionGroupsInformation_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForActionGroupsInformation_STATUS, ActionGroupsInformation_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ActionGroupsInformation_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 ActionGroupsInformation_STATUS instances for property testing - lazily instantiated by
// ActionGroupsInformation_STATUSGenerator()
var actionGroupsInformation_STATUSGenerator gopter.Gen

// ActionGroupsInformation_STATUSGenerator returns a generator of ActionGroupsInformation_STATUS instances for property testing.
func ActionGroupsInformation_STATUSGenerator() gopter.Gen {
	if actionGroupsInformation_STATUSGenerator != nil {
		return actionGroupsInformation_STATUSGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForActionGroupsInformation_STATUS(generators)
	actionGroupsInformation_STATUSGenerator = gen.Struct(reflect.TypeOf(ActionGroupsInformation_STATUS{}), generators)

	return actionGroupsInformation_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForActionGroupsInformation_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForActionGroupsInformation_STATUS(gens map[string]gopter.Gen) {
	gens["CustomEmailSubject"] = gen.PtrOf(gen.AlphaString())
	gens["CustomWebhookPayload"] = gen.PtrOf(gen.AlphaString())
	gens["GroupIds"] = gen.SliceOf(gen.AlphaString())
}

func Test_Detector_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 Detector via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDetector, DetectorGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// DetectorGenerator returns a generator of Detector instances for property testing.
func DetectorGenerator() gopter.Gen {
	if detectorGenerator != nil {
		return detectorGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDetector(generators)
	detectorGenerator = gen.Struct(reflect.TypeOf(Detector{}), generators)

	return detectorGenerator
}

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

func Test_DetectorParameterDefinition_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 DetectorParameterDefinition_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDetectorParameterDefinition_STATUS, DetectorParameterDefinition_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual DetectorParameterDefinition_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 DetectorParameterDefinition_STATUS instances for property testing - lazily instantiated by
// DetectorParameterDefinition_STATUSGenerator()
var detectorParameterDefinition_STATUSGenerator gopter.Gen

// DetectorParameterDefinition_STATUSGenerator returns a generator of DetectorParameterDefinition_STATUS instances for property testing.
func DetectorParameterDefinition_STATUSGenerator() gopter.Gen {
	if detectorParameterDefinition_STATUSGenerator != nil {
		return detectorParameterDefinition_STATUSGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDetectorParameterDefinition_STATUS(generators)
	detectorParameterDefinition_STATUSGenerator = gen.Struct(reflect.TypeOf(DetectorParameterDefinition_STATUS{}), generators)

	return detectorParameterDefinition_STATUSGenerator
}

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

func Test_Detector_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 Detector_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDetector_STATUS, Detector_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual Detector_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 Detector_STATUS instances for property testing - lazily instantiated by Detector_STATUSGenerator()
var detector_STATUSGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDetector_STATUS(generators)
	detector_STATUSGenerator = gen.Struct(reflect.TypeOf(Detector_STATUS{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDetector_STATUS(generators)
	AddRelatedPropertyGeneratorsForDetector_STATUS(generators)
	detector_STATUSGenerator = gen.Struct(reflect.TypeOf(Detector_STATUS{}), generators)

	return detector_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForDetector_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDetector_STATUS(gens map[string]gopter.Gen) {
	gens["Description"] = gen.PtrOf(gen.AlphaString())
	gens["Id"] = gen.PtrOf(gen.AlphaString())
	gens["ImagePaths"] = gen.SliceOf(gen.AlphaString())
	gens["Name"] = gen.PtrOf(gen.AlphaString())
	gens["SupportedCadences"] = gen.SliceOf(gen.Int())
	gens["SupportedResourceTypes"] = gen.SliceOf(gen.AlphaString())
}

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

func Test_SmartDetectorAlertRule_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) {
	t.Parallel()
	parameters := gopter.DefaultTestParameters()
	parameters.MinSuccessfulTests = 20
	parameters.MaxSize = 3
	properties := gopter.NewProperties(parameters)
	properties.Property(
		"Round trip of SmartDetectorAlertRule via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSmartDetectorAlertRule, SmartDetectorAlertRuleGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// SmartDetectorAlertRuleGenerator returns a generator of SmartDetectorAlertRule instances for property testing.
func SmartDetectorAlertRuleGenerator() gopter.Gen {
	if smartDetectorAlertRuleGenerator != nil {
		return smartDetectorAlertRuleGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddRelatedPropertyGeneratorsForSmartDetectorAlertRule(generators)
	smartDetectorAlertRuleGenerator = gen.Struct(reflect.TypeOf(SmartDetectorAlertRule{}), generators)

	return smartDetectorAlertRuleGenerator
}

// AddRelatedPropertyGeneratorsForSmartDetectorAlertRule is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForSmartDetectorAlertRule(gens map[string]gopter.Gen) {
	gens["Spec"] = SmartDetectorAlertRule_SpecGenerator()
	gens["Status"] = SmartDetectorAlertRule_STATUSGenerator()
}

func Test_SmartDetectorAlertRuleOperatorSpec_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 SmartDetectorAlertRuleOperatorSpec via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSmartDetectorAlertRuleOperatorSpec, SmartDetectorAlertRuleOperatorSpecGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// SmartDetectorAlertRuleOperatorSpecGenerator returns a generator of SmartDetectorAlertRuleOperatorSpec instances for property testing.
func SmartDetectorAlertRuleOperatorSpecGenerator() gopter.Gen {
	if smartDetectorAlertRuleOperatorSpecGenerator != nil {
		return smartDetectorAlertRuleOperatorSpecGenerator
	}

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

	return smartDetectorAlertRuleOperatorSpecGenerator
}

func Test_SmartDetectorAlertRule_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 SmartDetectorAlertRule_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSmartDetectorAlertRule_STATUS, SmartDetectorAlertRule_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual SmartDetectorAlertRule_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 SmartDetectorAlertRule_STATUS instances for property testing - lazily instantiated by
// SmartDetectorAlertRule_STATUSGenerator()
var smartDetectorAlertRule_STATUSGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSmartDetectorAlertRule_STATUS(generators)
	smartDetectorAlertRule_STATUSGenerator = gen.Struct(reflect.TypeOf(SmartDetectorAlertRule_STATUS{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSmartDetectorAlertRule_STATUS(generators)
	AddRelatedPropertyGeneratorsForSmartDetectorAlertRule_STATUS(generators)
	smartDetectorAlertRule_STATUSGenerator = gen.Struct(reflect.TypeOf(SmartDetectorAlertRule_STATUS{}), generators)

	return smartDetectorAlertRule_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForSmartDetectorAlertRule_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSmartDetectorAlertRule_STATUS(gens map[string]gopter.Gen) {
	gens["Description"] = gen.PtrOf(gen.AlphaString())
	gens["Frequency"] = gen.PtrOf(gen.AlphaString())
	gens["Id"] = gen.PtrOf(gen.AlphaString())
	gens["Location"] = gen.PtrOf(gen.AlphaString())
	gens["Name"] = gen.PtrOf(gen.AlphaString())
	gens["Scope"] = gen.SliceOf(gen.AlphaString())
	gens["Severity"] = gen.PtrOf(gen.AlphaString())
	gens["State"] = gen.PtrOf(gen.AlphaString())
	gens["Tags"] = gen.MapOf(
		gen.AlphaString(),
		gen.AlphaString())
	gens["Type"] = gen.PtrOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForSmartDetectorAlertRule_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForSmartDetectorAlertRule_STATUS(gens map[string]gopter.Gen) {
	gens["ActionGroups"] = gen.PtrOf(ActionGroupsInformation_STATUSGenerator())
	gens["Detector"] = gen.PtrOf(Detector_STATUSGenerator())
	gens["Throttling"] = gen.PtrOf(ThrottlingInformation_STATUSGenerator())
}

func Test_SmartDetectorAlertRule_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 SmartDetectorAlertRule_Spec via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSmartDetectorAlertRule_Spec, SmartDetectorAlertRule_SpecGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual SmartDetectorAlertRule_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 SmartDetectorAlertRule_Spec instances for property testing - lazily instantiated by
// SmartDetectorAlertRule_SpecGenerator()
var smartDetectorAlertRule_SpecGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSmartDetectorAlertRule_Spec(generators)
	smartDetectorAlertRule_SpecGenerator = gen.Struct(reflect.TypeOf(SmartDetectorAlertRule_Spec{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSmartDetectorAlertRule_Spec(generators)
	AddRelatedPropertyGeneratorsForSmartDetectorAlertRule_Spec(generators)
	smartDetectorAlertRule_SpecGenerator = gen.Struct(reflect.TypeOf(SmartDetectorAlertRule_Spec{}), generators)

	return smartDetectorAlertRule_SpecGenerator
}

// AddIndependentPropertyGeneratorsForSmartDetectorAlertRule_Spec is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSmartDetectorAlertRule_Spec(gens map[string]gopter.Gen) {
	gens["AzureName"] = gen.AlphaString()
	gens["Description"] = gen.PtrOf(gen.AlphaString())
	gens["Frequency"] = gen.PtrOf(gen.AlphaString())
	gens["Location"] = gen.PtrOf(gen.AlphaString())
	gens["OriginalVersion"] = gen.AlphaString()
	gens["Severity"] = gen.PtrOf(gen.AlphaString())
	gens["State"] = gen.PtrOf(gen.AlphaString())
	gens["Tags"] = gen.MapOf(
		gen.AlphaString(),
		gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForSmartDetectorAlertRule_Spec is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForSmartDetectorAlertRule_Spec(gens map[string]gopter.Gen) {
	gens["ActionGroups"] = gen.PtrOf(ActionGroupsInformationGenerator())
	gens["Detector"] = gen.PtrOf(DetectorGenerator())
	gens["OperatorSpec"] = gen.PtrOf(SmartDetectorAlertRuleOperatorSpecGenerator())
	gens["Throttling"] = gen.PtrOf(ThrottlingInformationGenerator())
}

func Test_ThrottlingInformation_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 ThrottlingInformation via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForThrottlingInformation, ThrottlingInformationGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ThrottlingInformationGenerator returns a generator of ThrottlingInformation instances for property testing.
func ThrottlingInformationGenerator() gopter.Gen {
	if throttlingInformationGenerator != nil {
		return throttlingInformationGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForThrottlingInformation(generators)
	throttlingInformationGenerator = gen.Struct(reflect.TypeOf(ThrottlingInformation{}), generators)

	return throttlingInformationGenerator
}

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

func Test_ThrottlingInformation_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 ThrottlingInformation_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForThrottlingInformation_STATUS, ThrottlingInformation_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ThrottlingInformation_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 ThrottlingInformation_STATUS instances for property testing - lazily instantiated by
// ThrottlingInformation_STATUSGenerator()
var throttlingInformation_STATUSGenerator gopter.Gen

// ThrottlingInformation_STATUSGenerator returns a generator of ThrottlingInformation_STATUS instances for property testing.
func ThrottlingInformation_STATUSGenerator() gopter.Gen {
	if throttlingInformation_STATUSGenerator != nil {
		return throttlingInformation_STATUSGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForThrottlingInformation_STATUS(generators)
	throttlingInformation_STATUSGenerator = gen.Struct(reflect.TypeOf(ThrottlingInformation_STATUS{}), generators)

	return throttlingInformation_STATUSGenerator
}

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