// 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_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_AlertRuleProperties_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 AlertRuleProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAlertRuleProperties_STATUS, AlertRuleProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AlertRuleProperties_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 AlertRuleProperties_STATUS instances for property testing - lazily instantiated by
// AlertRuleProperties_STATUSGenerator()
var alertRuleProperties_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForAlertRuleProperties_STATUS(generators)
	AddRelatedPropertyGeneratorsForAlertRuleProperties_STATUS(generators)
	alertRuleProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(AlertRuleProperties_STATUS{}), generators)

	return alertRuleProperties_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForAlertRuleProperties_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForAlertRuleProperties_STATUS(gens map[string]gopter.Gen) {
	gens["Description"] = gen.PtrOf(gen.AlphaString())
	gens["Frequency"] = gen.PtrOf(gen.AlphaString())
	gens["Scope"] = gen.SliceOf(gen.AlphaString())
	gens["Severity"] = gen.PtrOf(gen.OneConstOf(
		AlertRuleProperties_Severity_STATUS_Sev0,
		AlertRuleProperties_Severity_STATUS_Sev1,
		AlertRuleProperties_Severity_STATUS_Sev2,
		AlertRuleProperties_Severity_STATUS_Sev3,
		AlertRuleProperties_Severity_STATUS_Sev4))
	gens["State"] = gen.PtrOf(gen.OneConstOf(AlertRuleProperties_State_STATUS_Disabled, AlertRuleProperties_State_STATUS_Enabled))
}

// AddRelatedPropertyGeneratorsForAlertRuleProperties_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForAlertRuleProperties_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_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.OneConstOf(
		DetectorParameterDefinition_Type_STATUS_Boolean,
		DetectorParameterDefinition_Type_STATUS_DateTime,
		DetectorParameterDefinition_Type_STATUS_Double,
		DetectorParameterDefinition_Type_STATUS_Integer,
		DetectorParameterDefinition_Type_STATUS_String))
}

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_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["Id"] = gen.PtrOf(gen.AlphaString())
	gens["Location"] = gen.PtrOf(gen.AlphaString())
	gens["Name"] = 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["Properties"] = gen.PtrOf(AlertRuleProperties_STATUSGenerator())
}

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())
}
