// 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_DatabaseIdentity_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 DatabaseIdentity_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDatabaseIdentity_STATUS, DatabaseIdentity_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual DatabaseIdentity_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 DatabaseIdentity_STATUS instances for property testing - lazily instantiated by
// DatabaseIdentity_STATUSGenerator()
var databaseIdentity_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDatabaseIdentity_STATUS(generators)
	AddRelatedPropertyGeneratorsForDatabaseIdentity_STATUS(generators)
	databaseIdentity_STATUSGenerator = gen.Struct(reflect.TypeOf(DatabaseIdentity_STATUS{}), generators)

	return databaseIdentity_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForDatabaseIdentity_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDatabaseIdentity_STATUS(gens map[string]gopter.Gen) {
	gens["TenantId"] = gen.PtrOf(gen.AlphaString())
	gens["Type"] = gen.PtrOf(gen.OneConstOf(DatabaseIdentity_Type_STATUS_None, DatabaseIdentity_Type_STATUS_UserAssigned))
}

// AddRelatedPropertyGeneratorsForDatabaseIdentity_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForDatabaseIdentity_STATUS(gens map[string]gopter.Gen) {
	gens["UserAssignedIdentities"] = gen.MapOf(
		gen.AlphaString(),
		DatabaseUserIdentity_STATUSGenerator())
}

func Test_DatabaseProperties_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 DatabaseProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDatabaseProperties_STATUS, DatabaseProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual DatabaseProperties_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 DatabaseProperties_STATUS instances for property testing - lazily instantiated by
// DatabaseProperties_STATUSGenerator()
var databaseProperties_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForDatabaseProperties_STATUS(generators)
	AddRelatedPropertyGeneratorsForDatabaseProperties_STATUS(generators)
	databaseProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(DatabaseProperties_STATUS{}), generators)

	return databaseProperties_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForDatabaseProperties_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForDatabaseProperties_STATUS(gens map[string]gopter.Gen) {
	gens["AutoPauseDelay"] = gen.PtrOf(gen.Int())
	gens["CatalogCollation"] = gen.PtrOf(gen.OneConstOf(DatabaseProperties_CatalogCollation_STATUS_DATABASE_DEFAULT, DatabaseProperties_CatalogCollation_STATUS_SQL_Latin1_General_CP1_CI_AS))
	gens["Collation"] = gen.PtrOf(gen.AlphaString())
	gens["CreateMode"] = gen.PtrOf(gen.OneConstOf(
		DatabaseProperties_CreateMode_STATUS_Copy,
		DatabaseProperties_CreateMode_STATUS_Default,
		DatabaseProperties_CreateMode_STATUS_OnlineSecondary,
		DatabaseProperties_CreateMode_STATUS_PointInTimeRestore,
		DatabaseProperties_CreateMode_STATUS_Recovery,
		DatabaseProperties_CreateMode_STATUS_Restore,
		DatabaseProperties_CreateMode_STATUS_RestoreExternalBackup,
		DatabaseProperties_CreateMode_STATUS_RestoreExternalBackupSecondary,
		DatabaseProperties_CreateMode_STATUS_RestoreLongTermRetentionBackup,
		DatabaseProperties_CreateMode_STATUS_Secondary))
	gens["CreationDate"] = gen.PtrOf(gen.AlphaString())
	gens["CurrentBackupStorageRedundancy"] = gen.PtrOf(gen.OneConstOf(
		DatabaseProperties_CurrentBackupStorageRedundancy_STATUS_Geo,
		DatabaseProperties_CurrentBackupStorageRedundancy_STATUS_GeoZone,
		DatabaseProperties_CurrentBackupStorageRedundancy_STATUS_Local,
		DatabaseProperties_CurrentBackupStorageRedundancy_STATUS_Zone))
	gens["CurrentServiceObjectiveName"] = gen.PtrOf(gen.AlphaString())
	gens["DatabaseId"] = gen.PtrOf(gen.AlphaString())
	gens["DefaultSecondaryLocation"] = gen.PtrOf(gen.AlphaString())
	gens["EarliestRestoreDate"] = gen.PtrOf(gen.AlphaString())
	gens["ElasticPoolId"] = gen.PtrOf(gen.AlphaString())
	gens["FailoverGroupId"] = gen.PtrOf(gen.AlphaString())
	gens["FederatedClientId"] = gen.PtrOf(gen.AlphaString())
	gens["HighAvailabilityReplicaCount"] = gen.PtrOf(gen.Int())
	gens["IsInfraEncryptionEnabled"] = gen.PtrOf(gen.Bool())
	gens["IsLedgerOn"] = gen.PtrOf(gen.Bool())
	gens["LicenseType"] = gen.PtrOf(gen.OneConstOf(DatabaseProperties_LicenseType_STATUS_BasePrice, DatabaseProperties_LicenseType_STATUS_LicenseIncluded))
	gens["LongTermRetentionBackupResourceId"] = gen.PtrOf(gen.AlphaString())
	gens["MaintenanceConfigurationId"] = gen.PtrOf(gen.AlphaString())
	gens["MaxLogSizeBytes"] = gen.PtrOf(gen.Int())
	gens["MaxSizeBytes"] = gen.PtrOf(gen.Int())
	gens["MinCapacity"] = gen.PtrOf(gen.Float64())
	gens["PausedDate"] = gen.PtrOf(gen.AlphaString())
	gens["ReadScale"] = gen.PtrOf(gen.OneConstOf(DatabaseProperties_ReadScale_STATUS_Disabled, DatabaseProperties_ReadScale_STATUS_Enabled))
	gens["RecoverableDatabaseId"] = gen.PtrOf(gen.AlphaString())
	gens["RecoveryServicesRecoveryPointId"] = gen.PtrOf(gen.AlphaString())
	gens["RequestedBackupStorageRedundancy"] = gen.PtrOf(gen.OneConstOf(
		DatabaseProperties_RequestedBackupStorageRedundancy_STATUS_Geo,
		DatabaseProperties_RequestedBackupStorageRedundancy_STATUS_GeoZone,
		DatabaseProperties_RequestedBackupStorageRedundancy_STATUS_Local,
		DatabaseProperties_RequestedBackupStorageRedundancy_STATUS_Zone))
	gens["RequestedServiceObjectiveName"] = gen.PtrOf(gen.AlphaString())
	gens["RestorableDroppedDatabaseId"] = gen.PtrOf(gen.AlphaString())
	gens["RestorePointInTime"] = gen.PtrOf(gen.AlphaString())
	gens["ResumedDate"] = gen.PtrOf(gen.AlphaString())
	gens["SampleName"] = gen.PtrOf(gen.OneConstOf(DatabaseProperties_SampleName_STATUS_AdventureWorksLT, DatabaseProperties_SampleName_STATUS_WideWorldImportersFull, DatabaseProperties_SampleName_STATUS_WideWorldImportersStd))
	gens["SecondaryType"] = gen.PtrOf(gen.OneConstOf(DatabaseProperties_SecondaryType_STATUS_Geo, DatabaseProperties_SecondaryType_STATUS_Named))
	gens["SourceDatabaseDeletionDate"] = gen.PtrOf(gen.AlphaString())
	gens["SourceDatabaseId"] = gen.PtrOf(gen.AlphaString())
	gens["SourceResourceId"] = gen.PtrOf(gen.AlphaString())
	gens["Status"] = gen.PtrOf(gen.OneConstOf(
		DatabaseProperties_Status_STATUS_AutoClosed,
		DatabaseProperties_Status_STATUS_Copying,
		DatabaseProperties_Status_STATUS_Creating,
		DatabaseProperties_Status_STATUS_Disabled,
		DatabaseProperties_Status_STATUS_EmergencyMode,
		DatabaseProperties_Status_STATUS_Inaccessible,
		DatabaseProperties_Status_STATUS_Offline,
		DatabaseProperties_Status_STATUS_OfflineChangingDwPerformanceTiers,
		DatabaseProperties_Status_STATUS_OfflineSecondary,
		DatabaseProperties_Status_STATUS_Online,
		DatabaseProperties_Status_STATUS_OnlineChangingDwPerformanceTiers,
		DatabaseProperties_Status_STATUS_Paused,
		DatabaseProperties_Status_STATUS_Pausing,
		DatabaseProperties_Status_STATUS_Recovering,
		DatabaseProperties_Status_STATUS_RecoveryPending,
		DatabaseProperties_Status_STATUS_Restoring,
		DatabaseProperties_Status_STATUS_Resuming,
		DatabaseProperties_Status_STATUS_Scaling,
		DatabaseProperties_Status_STATUS_Shutdown,
		DatabaseProperties_Status_STATUS_Standby,
		DatabaseProperties_Status_STATUS_Starting,
		DatabaseProperties_Status_STATUS_Stopped,
		DatabaseProperties_Status_STATUS_Stopping,
		DatabaseProperties_Status_STATUS_Suspect))
	gens["ZoneRedundant"] = gen.PtrOf(gen.Bool())
}

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

func Test_DatabaseUserIdentity_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 DatabaseUserIdentity_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForDatabaseUserIdentity_STATUS, DatabaseUserIdentity_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual DatabaseUserIdentity_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 DatabaseUserIdentity_STATUS instances for property testing - lazily instantiated by
// DatabaseUserIdentity_STATUSGenerator()
var databaseUserIdentity_STATUSGenerator gopter.Gen

// DatabaseUserIdentity_STATUSGenerator returns a generator of DatabaseUserIdentity_STATUS instances for property testing.
func DatabaseUserIdentity_STATUSGenerator() gopter.Gen {
	if databaseUserIdentity_STATUSGenerator != nil {
		return databaseUserIdentity_STATUSGenerator
	}

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

	return databaseUserIdentity_STATUSGenerator
}

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

func Test_ServersDatabase_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 ServersDatabase_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForServersDatabase_STATUS, ServersDatabase_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual ServersDatabase_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 ServersDatabase_STATUS instances for property testing - lazily instantiated by
// ServersDatabase_STATUSGenerator()
var serversDatabase_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForServersDatabase_STATUS(generators)
	AddRelatedPropertyGeneratorsForServersDatabase_STATUS(generators)
	serversDatabase_STATUSGenerator = gen.Struct(reflect.TypeOf(ServersDatabase_STATUS{}), generators)

	return serversDatabase_STATUSGenerator
}

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

// AddRelatedPropertyGeneratorsForServersDatabase_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForServersDatabase_STATUS(gens map[string]gopter.Gen) {
	gens["Identity"] = gen.PtrOf(DatabaseIdentity_STATUSGenerator())
	gens["Properties"] = gen.PtrOf(DatabaseProperties_STATUSGenerator())
	gens["Sku"] = gen.PtrOf(Sku_STATUSGenerator())
}

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

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

	// Deserialize back into memory
	var actual Sku_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 Sku_STATUS instances for property testing - lazily instantiated by Sku_STATUSGenerator()
var sku_STATUSGenerator gopter.Gen

// Sku_STATUSGenerator returns a generator of Sku_STATUS instances for property testing.
func Sku_STATUSGenerator() gopter.Gen {
	if sku_STATUSGenerator != nil {
		return sku_STATUSGenerator
	}

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

	return sku_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForSku_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSku_STATUS(gens map[string]gopter.Gen) {
	gens["Capacity"] = gen.PtrOf(gen.Int())
	gens["Family"] = gen.PtrOf(gen.AlphaString())
	gens["Name"] = gen.PtrOf(gen.AlphaString())
	gens["Size"] = gen.PtrOf(gen.AlphaString())
	gens["Tier"] = gen.PtrOf(gen.AlphaString())
}
