// 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_BastionHostIPConfiguration_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 BastionHostIPConfiguration_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForBastionHostIPConfiguration_STATUS, BastionHostIPConfiguration_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual BastionHostIPConfiguration_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 BastionHostIPConfiguration_STATUS instances for property testing - lazily instantiated by
// BastionHostIPConfiguration_STATUSGenerator()
var bastionHostIPConfiguration_STATUSGenerator gopter.Gen

// BastionHostIPConfiguration_STATUSGenerator returns a generator of BastionHostIPConfiguration_STATUS instances for property testing.
func BastionHostIPConfiguration_STATUSGenerator() gopter.Gen {
	if bastionHostIPConfiguration_STATUSGenerator != nil {
		return bastionHostIPConfiguration_STATUSGenerator
	}

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

	return bastionHostIPConfiguration_STATUSGenerator
}

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

func Test_BastionHostPropertiesFormat_NetworkAcls_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 BastionHostPropertiesFormat_NetworkAcls_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForBastionHostPropertiesFormat_NetworkAcls_STATUS, BastionHostPropertiesFormat_NetworkAcls_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual BastionHostPropertiesFormat_NetworkAcls_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 BastionHostPropertiesFormat_NetworkAcls_STATUS instances for property testing - lazily instantiated by
// BastionHostPropertiesFormat_NetworkAcls_STATUSGenerator()
var bastionHostPropertiesFormat_NetworkAcls_STATUSGenerator gopter.Gen

// BastionHostPropertiesFormat_NetworkAcls_STATUSGenerator returns a generator of BastionHostPropertiesFormat_NetworkAcls_STATUS instances for property testing.
func BastionHostPropertiesFormat_NetworkAcls_STATUSGenerator() gopter.Gen {
	if bastionHostPropertiesFormat_NetworkAcls_STATUSGenerator != nil {
		return bastionHostPropertiesFormat_NetworkAcls_STATUSGenerator
	}

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

	return bastionHostPropertiesFormat_NetworkAcls_STATUSGenerator
}

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

func Test_BastionHostPropertiesFormat_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 BastionHostPropertiesFormat_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForBastionHostPropertiesFormat_STATUS, BastionHostPropertiesFormat_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual BastionHostPropertiesFormat_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 BastionHostPropertiesFormat_STATUS instances for property testing - lazily instantiated by
// BastionHostPropertiesFormat_STATUSGenerator()
var bastionHostPropertiesFormat_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForBastionHostPropertiesFormat_STATUS(generators)
	AddRelatedPropertyGeneratorsForBastionHostPropertiesFormat_STATUS(generators)
	bastionHostPropertiesFormat_STATUSGenerator = gen.Struct(reflect.TypeOf(BastionHostPropertiesFormat_STATUS{}), generators)

	return bastionHostPropertiesFormat_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForBastionHostPropertiesFormat_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForBastionHostPropertiesFormat_STATUS(gens map[string]gopter.Gen) {
	gens["DisableCopyPaste"] = gen.PtrOf(gen.Bool())
	gens["DnsName"] = gen.PtrOf(gen.AlphaString())
	gens["EnableFileCopy"] = gen.PtrOf(gen.Bool())
	gens["EnableIpConnect"] = gen.PtrOf(gen.Bool())
	gens["EnableKerberos"] = gen.PtrOf(gen.Bool())
	gens["EnableSessionRecording"] = gen.PtrOf(gen.Bool())
	gens["EnableShareableLink"] = gen.PtrOf(gen.Bool())
	gens["EnableTunneling"] = gen.PtrOf(gen.Bool())
	gens["ProvisioningState"] = gen.PtrOf(gen.OneConstOf(
		ProvisioningState_STATUS_Deleting,
		ProvisioningState_STATUS_Failed,
		ProvisioningState_STATUS_Succeeded,
		ProvisioningState_STATUS_Updating))
	gens["ScaleUnits"] = gen.PtrOf(gen.Int())
}

// AddRelatedPropertyGeneratorsForBastionHostPropertiesFormat_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForBastionHostPropertiesFormat_STATUS(gens map[string]gopter.Gen) {
	gens["IpConfigurations"] = gen.SliceOf(BastionHostIPConfiguration_STATUSGenerator())
	gens["NetworkAcls"] = gen.PtrOf(BastionHostPropertiesFormat_NetworkAcls_STATUSGenerator())
	gens["VirtualNetwork"] = gen.PtrOf(SubResource_STATUSGenerator())
}

func Test_BastionHost_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 BastionHost_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForBastionHost_STATUS, BastionHost_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual BastionHost_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 BastionHost_STATUS instances for property testing - lazily instantiated by BastionHost_STATUSGenerator()
var bastionHost_STATUSGenerator gopter.Gen

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

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

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForBastionHost_STATUS(generators)
	AddRelatedPropertyGeneratorsForBastionHost_STATUS(generators)
	bastionHost_STATUSGenerator = gen.Struct(reflect.TypeOf(BastionHost_STATUS{}), generators)

	return bastionHost_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForBastionHost_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForBastionHost_STATUS(gens map[string]gopter.Gen) {
	gens["Etag"] = gen.PtrOf(gen.AlphaString())
	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())
	gens["Zones"] = gen.SliceOf(gen.AlphaString())
}

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

func Test_IPRule_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 IPRule_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForIPRule_STATUS, IPRule_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual IPRule_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 IPRule_STATUS instances for property testing - lazily instantiated by IPRule_STATUSGenerator()
var ipRule_STATUSGenerator gopter.Gen

// IPRule_STATUSGenerator returns a generator of IPRule_STATUS instances for property testing.
func IPRule_STATUSGenerator() gopter.Gen {
	if ipRule_STATUSGenerator != nil {
		return ipRule_STATUSGenerator
	}

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

	return ipRule_STATUSGenerator
}

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

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["Name"] = gen.PtrOf(gen.OneConstOf(
		Sku_Name_STATUS_Basic,
		Sku_Name_STATUS_Developer,
		Sku_Name_STATUS_Premium,
		Sku_Name_STATUS_Standard))
}
