// 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_ClientEncryptionIncludedPath_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 ClientEncryptionIncludedPath via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForClientEncryptionIncludedPath, ClientEncryptionIncludedPathGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ClientEncryptionIncludedPathGenerator returns a generator of ClientEncryptionIncludedPath instances for property testing.
func ClientEncryptionIncludedPathGenerator() gopter.Gen {
	if clientEncryptionIncludedPathGenerator != nil {
		return clientEncryptionIncludedPathGenerator
	}

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

	return clientEncryptionIncludedPathGenerator
}

// AddIndependentPropertyGeneratorsForClientEncryptionIncludedPath is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForClientEncryptionIncludedPath(gens map[string]gopter.Gen) {
	gens["ClientEncryptionKeyId"] = gen.PtrOf(gen.AlphaString())
	gens["EncryptionAlgorithm"] = gen.PtrOf(gen.AlphaString())
	gens["EncryptionType"] = gen.PtrOf(gen.AlphaString())
	gens["Path"] = gen.PtrOf(gen.AlphaString())
}

func Test_ClientEncryptionPolicy_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 ClientEncryptionPolicy via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForClientEncryptionPolicy, ClientEncryptionPolicyGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForClientEncryptionPolicy(generators)
	AddRelatedPropertyGeneratorsForClientEncryptionPolicy(generators)
	clientEncryptionPolicyGenerator = gen.Struct(reflect.TypeOf(ClientEncryptionPolicy{}), generators)

	return clientEncryptionPolicyGenerator
}

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

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

func Test_CompositePath_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 CompositePath via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForCompositePath, CompositePathGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// CompositePathGenerator returns a generator of CompositePath instances for property testing.
func CompositePathGenerator() gopter.Gen {
	if compositePathGenerator != nil {
		return compositePathGenerator
	}

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

	return compositePathGenerator
}

// AddIndependentPropertyGeneratorsForCompositePath is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForCompositePath(gens map[string]gopter.Gen) {
	gens["Order"] = gen.PtrOf(gen.OneConstOf(CompositePath_Order_Ascending, CompositePath_Order_Descending))
	gens["Path"] = gen.PtrOf(gen.AlphaString())
}

func Test_ComputedProperty_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 ComputedProperty via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForComputedProperty, ComputedPropertyGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ComputedPropertyGenerator returns a generator of ComputedProperty instances for property testing.
func ComputedPropertyGenerator() gopter.Gen {
	if computedPropertyGenerator != nil {
		return computedPropertyGenerator
	}

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

	return computedPropertyGenerator
}

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

func Test_ConflictResolutionPolicy_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 ConflictResolutionPolicy via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForConflictResolutionPolicy, ConflictResolutionPolicyGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ConflictResolutionPolicyGenerator returns a generator of ConflictResolutionPolicy instances for property testing.
func ConflictResolutionPolicyGenerator() gopter.Gen {
	if conflictResolutionPolicyGenerator != nil {
		return conflictResolutionPolicyGenerator
	}

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

	return conflictResolutionPolicyGenerator
}

// AddIndependentPropertyGeneratorsForConflictResolutionPolicy is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForConflictResolutionPolicy(gens map[string]gopter.Gen) {
	gens["ConflictResolutionPath"] = gen.PtrOf(gen.AlphaString())
	gens["ConflictResolutionProcedure"] = gen.PtrOf(gen.AlphaString())
	gens["Mode"] = gen.PtrOf(gen.OneConstOf(ConflictResolutionPolicy_Mode_Custom, ConflictResolutionPolicy_Mode_LastWriterWins))
}

func Test_ContainerPartitionKey_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 ContainerPartitionKey via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForContainerPartitionKey, ContainerPartitionKeyGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ContainerPartitionKeyGenerator returns a generator of ContainerPartitionKey instances for property testing.
func ContainerPartitionKeyGenerator() gopter.Gen {
	if containerPartitionKeyGenerator != nil {
		return containerPartitionKeyGenerator
	}

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

	return containerPartitionKeyGenerator
}

// AddIndependentPropertyGeneratorsForContainerPartitionKey is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForContainerPartitionKey(gens map[string]gopter.Gen) {
	gens["Kind"] = gen.PtrOf(gen.OneConstOf(ContainerPartitionKey_Kind_Hash, ContainerPartitionKey_Kind_MultiHash, ContainerPartitionKey_Kind_Range))
	gens["Paths"] = gen.SliceOf(gen.AlphaString())
	gens["Version"] = gen.PtrOf(gen.Int())
}

func Test_ExcludedPath_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 ExcludedPath via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForExcludedPath, ExcludedPathGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// ExcludedPathGenerator returns a generator of ExcludedPath instances for property testing.
func ExcludedPathGenerator() gopter.Gen {
	if excludedPathGenerator != nil {
		return excludedPathGenerator
	}

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

	return excludedPathGenerator
}

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

func Test_IncludedPath_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 IncludedPath via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForIncludedPath, IncludedPathGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForIncludedPath(generators)
	AddRelatedPropertyGeneratorsForIncludedPath(generators)
	includedPathGenerator = gen.Struct(reflect.TypeOf(IncludedPath{}), generators)

	return includedPathGenerator
}

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

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

func Test_Indexes_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 Indexes via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForIndexes, IndexesGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// IndexesGenerator returns a generator of Indexes instances for property testing.
func IndexesGenerator() gopter.Gen {
	if indexesGenerator != nil {
		return indexesGenerator
	}

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

	return indexesGenerator
}

// AddIndependentPropertyGeneratorsForIndexes is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForIndexes(gens map[string]gopter.Gen) {
	gens["DataType"] = gen.PtrOf(gen.OneConstOf(
		Indexes_DataType_LineString,
		Indexes_DataType_MultiPolygon,
		Indexes_DataType_Number,
		Indexes_DataType_Point,
		Indexes_DataType_Polygon,
		Indexes_DataType_String))
	gens["Kind"] = gen.PtrOf(gen.OneConstOf(Indexes_Kind_Hash, Indexes_Kind_Range, Indexes_Kind_Spatial))
	gens["Precision"] = gen.PtrOf(gen.Int())
}

func Test_IndexingPolicy_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 IndexingPolicy via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForIndexingPolicy, IndexingPolicyGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForIndexingPolicy(generators)
	AddRelatedPropertyGeneratorsForIndexingPolicy(generators)
	indexingPolicyGenerator = gen.Struct(reflect.TypeOf(IndexingPolicy{}), generators)

	return indexingPolicyGenerator
}

// AddIndependentPropertyGeneratorsForIndexingPolicy is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForIndexingPolicy(gens map[string]gopter.Gen) {
	gens["Automatic"] = gen.PtrOf(gen.Bool())
	gens["IndexingMode"] = gen.PtrOf(gen.OneConstOf(IndexingPolicy_IndexingMode_Consistent, IndexingPolicy_IndexingMode_Lazy, IndexingPolicy_IndexingMode_None))
}

// AddRelatedPropertyGeneratorsForIndexingPolicy is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForIndexingPolicy(gens map[string]gopter.Gen) {
	gens["CompositeIndexes"] = gen.SliceOf(gen.SliceOf(CompositePathGenerator()))
	gens["ExcludedPaths"] = gen.SliceOf(ExcludedPathGenerator())
	gens["IncludedPaths"] = gen.SliceOf(IncludedPathGenerator())
	gens["SpatialIndexes"] = gen.SliceOf(SpatialSpecGenerator())
}

func Test_SpatialSpec_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 SpatialSpec via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSpatialSpec, SpatialSpecGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// SpatialSpecGenerator returns a generator of SpatialSpec instances for property testing.
func SpatialSpecGenerator() gopter.Gen {
	if spatialSpecGenerator != nil {
		return spatialSpecGenerator
	}

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

	return spatialSpecGenerator
}

// AddIndependentPropertyGeneratorsForSpatialSpec is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSpatialSpec(gens map[string]gopter.Gen) {
	gens["Path"] = gen.PtrOf(gen.AlphaString())
	gens["Types"] = gen.SliceOf(gen.OneConstOf(
		SpatialType_LineString,
		SpatialType_MultiPolygon,
		SpatialType_Point,
		SpatialType_Polygon))
}

func Test_SqlContainerCreateUpdateProperties_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 SqlContainerCreateUpdateProperties via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSqlContainerCreateUpdateProperties, SqlContainerCreateUpdatePropertiesGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// SqlContainerCreateUpdatePropertiesGenerator returns a generator of SqlContainerCreateUpdateProperties instances for property testing.
func SqlContainerCreateUpdatePropertiesGenerator() gopter.Gen {
	if sqlContainerCreateUpdatePropertiesGenerator != nil {
		return sqlContainerCreateUpdatePropertiesGenerator
	}

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

	return sqlContainerCreateUpdatePropertiesGenerator
}

// AddRelatedPropertyGeneratorsForSqlContainerCreateUpdateProperties is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForSqlContainerCreateUpdateProperties(gens map[string]gopter.Gen) {
	gens["Options"] = gen.PtrOf(CreateUpdateOptionsGenerator())
	gens["Resource"] = gen.PtrOf(SqlContainerResourceGenerator())
}

func Test_SqlContainerResource_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 SqlContainerResource via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSqlContainerResource, SqlContainerResourceGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSqlContainerResource(generators)
	AddRelatedPropertyGeneratorsForSqlContainerResource(generators)
	sqlContainerResourceGenerator = gen.Struct(reflect.TypeOf(SqlContainerResource{}), generators)

	return sqlContainerResourceGenerator
}

// AddIndependentPropertyGeneratorsForSqlContainerResource is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSqlContainerResource(gens map[string]gopter.Gen) {
	gens["AnalyticalStorageTtl"] = gen.PtrOf(gen.Int())
	gens["CreateMode"] = gen.PtrOf(gen.OneConstOf(CreateMode_Default, CreateMode_Restore))
	gens["DefaultTtl"] = gen.PtrOf(gen.Int())
	gens["Id"] = gen.PtrOf(gen.AlphaString())
}

// AddRelatedPropertyGeneratorsForSqlContainerResource is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForSqlContainerResource(gens map[string]gopter.Gen) {
	gens["ClientEncryptionPolicy"] = gen.PtrOf(ClientEncryptionPolicyGenerator())
	gens["ComputedProperties"] = gen.SliceOf(ComputedPropertyGenerator())
	gens["ConflictResolutionPolicy"] = gen.PtrOf(ConflictResolutionPolicyGenerator())
	gens["IndexingPolicy"] = gen.PtrOf(IndexingPolicyGenerator())
	gens["PartitionKey"] = gen.PtrOf(ContainerPartitionKeyGenerator())
	gens["RestoreParameters"] = gen.PtrOf(RestoreParametersBaseGenerator())
	gens["UniqueKeyPolicy"] = gen.PtrOf(UniqueKeyPolicyGenerator())
}

func Test_SqlDatabaseContainer_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 SqlDatabaseContainer_Spec via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSqlDatabaseContainer_Spec, SqlDatabaseContainer_SpecGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual SqlDatabaseContainer_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 SqlDatabaseContainer_Spec instances for property testing - lazily instantiated by
// SqlDatabaseContainer_SpecGenerator()
var sqlDatabaseContainer_SpecGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSqlDatabaseContainer_Spec(generators)
	AddRelatedPropertyGeneratorsForSqlDatabaseContainer_Spec(generators)
	sqlDatabaseContainer_SpecGenerator = gen.Struct(reflect.TypeOf(SqlDatabaseContainer_Spec{}), generators)

	return sqlDatabaseContainer_SpecGenerator
}

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

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

func Test_UniqueKey_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 UniqueKey via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForUniqueKey, UniqueKeyGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// UniqueKeyGenerator returns a generator of UniqueKey instances for property testing.
func UniqueKeyGenerator() gopter.Gen {
	if uniqueKeyGenerator != nil {
		return uniqueKeyGenerator
	}

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

	return uniqueKeyGenerator
}

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

func Test_UniqueKeyPolicy_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 UniqueKeyPolicy via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForUniqueKeyPolicy, UniqueKeyPolicyGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

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

// UniqueKeyPolicyGenerator returns a generator of UniqueKeyPolicy instances for property testing.
func UniqueKeyPolicyGenerator() gopter.Gen {
	if uniqueKeyPolicyGenerator != nil {
		return uniqueKeyPolicyGenerator
	}

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

	return uniqueKeyPolicyGenerator
}

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