// 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_DatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_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 DatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUS, DatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual DatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_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 DatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUS instances for property
// testing - lazily instantiated by
// DatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUSGenerator()
var databaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUS(generators)
	AddRelatedPropertyGeneratorsForDatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUS(generators)
	databaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(DatabaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUS{}), generators)

	return databaseVulnerabilityAssessmentsDatabaseVulnerabilityAssessmentProperties_STATUSGenerator
}

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

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

func Test_ServersDatabasesVulnerabilityAssessment_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 ServersDatabasesVulnerabilityAssessment_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForServersDatabasesVulnerabilityAssessment_STATUS, ServersDatabasesVulnerabilityAssessment_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ServersDatabasesVulnerabilityAssessment_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 ServersDatabasesVulnerabilityAssessment_STATUS instances for property testing - lazily instantiated by
// ServersDatabasesVulnerabilityAssessment_STATUSGenerator()
var serversDatabasesVulnerabilityAssessment_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForServersDatabasesVulnerabilityAssessment_STATUS(generators)
	AddRelatedPropertyGeneratorsForServersDatabasesVulnerabilityAssessment_STATUS(generators)
	serversDatabasesVulnerabilityAssessment_STATUSGenerator = gen.Struct(reflect.TypeOf(ServersDatabasesVulnerabilityAssessment_STATUS{}), generators)

	return serversDatabasesVulnerabilityAssessment_STATUSGenerator
}

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

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

func Test_VulnerabilityAssessmentRecurringScansProperties_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 VulnerabilityAssessmentRecurringScansProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForVulnerabilityAssessmentRecurringScansProperties_STATUS, VulnerabilityAssessmentRecurringScansProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual VulnerabilityAssessmentRecurringScansProperties_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 VulnerabilityAssessmentRecurringScansProperties_STATUS instances for property testing - lazily
// instantiated by VulnerabilityAssessmentRecurringScansProperties_STATUSGenerator()
var vulnerabilityAssessmentRecurringScansProperties_STATUSGenerator gopter.Gen

// VulnerabilityAssessmentRecurringScansProperties_STATUSGenerator returns a generator of VulnerabilityAssessmentRecurringScansProperties_STATUS instances for property testing.
func VulnerabilityAssessmentRecurringScansProperties_STATUSGenerator() gopter.Gen {
	if vulnerabilityAssessmentRecurringScansProperties_STATUSGenerator != nil {
		return vulnerabilityAssessmentRecurringScansProperties_STATUSGenerator
	}

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

	return vulnerabilityAssessmentRecurringScansProperties_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForVulnerabilityAssessmentRecurringScansProperties_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForVulnerabilityAssessmentRecurringScansProperties_STATUS(gens map[string]gopter.Gen) {
	gens["EmailSubscriptionAdmins"] = gen.PtrOf(gen.Bool())
	gens["Emails"] = gen.SliceOf(gen.AlphaString())
	gens["IsEnabled"] = gen.PtrOf(gen.Bool())
}
