// 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_AccessPolicy_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 AccessPolicy_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForAccessPolicy_STATUS, AccessPolicy_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual AccessPolicy_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 AccessPolicy_STATUS instances for property testing - lazily instantiated by
// AccessPolicy_STATUSGenerator()
var accessPolicy_STATUSGenerator gopter.Gen

// AccessPolicy_STATUSGenerator returns a generator of AccessPolicy_STATUS instances for property testing.
func AccessPolicy_STATUSGenerator() gopter.Gen {
	if accessPolicy_STATUSGenerator != nil {
		return accessPolicy_STATUSGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForAccessPolicy_STATUS(generators)
	accessPolicy_STATUSGenerator = gen.Struct(reflect.TypeOf(AccessPolicy_STATUS{}), generators)

	return accessPolicy_STATUSGenerator
}

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

func Test_FileShareProperties_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 FileShareProperties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForFileShareProperties_STATUS, FileShareProperties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual FileShareProperties_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 FileShareProperties_STATUS instances for property testing - lazily instantiated by
// FileShareProperties_STATUSGenerator()
var fileShareProperties_STATUSGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForFileShareProperties_STATUS(generators)
	fileShareProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(FileShareProperties_STATUS{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForFileShareProperties_STATUS(generators)
	AddRelatedPropertyGeneratorsForFileShareProperties_STATUS(generators)
	fileShareProperties_STATUSGenerator = gen.Struct(reflect.TypeOf(FileShareProperties_STATUS{}), generators)

	return fileShareProperties_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForFileShareProperties_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForFileShareProperties_STATUS(gens map[string]gopter.Gen) {
	gens["AccessTier"] = gen.PtrOf(gen.OneConstOf(
		FileShareProperties_AccessTier_STATUS_Cool,
		FileShareProperties_AccessTier_STATUS_Hot,
		FileShareProperties_AccessTier_STATUS_Premium,
		FileShareProperties_AccessTier_STATUS_TransactionOptimized))
	gens["AccessTierChangeTime"] = gen.PtrOf(gen.AlphaString())
	gens["AccessTierStatus"] = gen.PtrOf(gen.AlphaString())
	gens["Deleted"] = gen.PtrOf(gen.Bool())
	gens["DeletedTime"] = gen.PtrOf(gen.AlphaString())
	gens["EnabledProtocols"] = gen.PtrOf(gen.OneConstOf(FileShareProperties_EnabledProtocols_STATUS_NFS, FileShareProperties_EnabledProtocols_STATUS_SMB))
	gens["LastModifiedTime"] = gen.PtrOf(gen.AlphaString())
	gens["LeaseDuration"] = gen.PtrOf(gen.OneConstOf(FileShareProperties_LeaseDuration_STATUS_Fixed, FileShareProperties_LeaseDuration_STATUS_Infinite))
	gens["LeaseState"] = gen.PtrOf(gen.OneConstOf(
		FileShareProperties_LeaseState_STATUS_Available,
		FileShareProperties_LeaseState_STATUS_Breaking,
		FileShareProperties_LeaseState_STATUS_Broken,
		FileShareProperties_LeaseState_STATUS_Expired,
		FileShareProperties_LeaseState_STATUS_Leased))
	gens["LeaseStatus"] = gen.PtrOf(gen.OneConstOf(FileShareProperties_LeaseStatus_STATUS_Locked, FileShareProperties_LeaseStatus_STATUS_Unlocked))
	gens["Metadata"] = gen.MapOf(
		gen.AlphaString(),
		gen.AlphaString())
	gens["RemainingRetentionDays"] = gen.PtrOf(gen.Int())
	gens["RootSquash"] = gen.PtrOf(gen.OneConstOf(FileShareProperties_RootSquash_STATUS_AllSquash, FileShareProperties_RootSquash_STATUS_NoRootSquash, FileShareProperties_RootSquash_STATUS_RootSquash))
	gens["ShareQuota"] = gen.PtrOf(gen.Int())
	gens["ShareUsageBytes"] = gen.PtrOf(gen.Int())
	gens["SnapshotTime"] = gen.PtrOf(gen.AlphaString())
	gens["Version"] = gen.PtrOf(gen.AlphaString())
}

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

func Test_SignedIdentifier_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 SignedIdentifier_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSignedIdentifier_STATUS, SignedIdentifier_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual SignedIdentifier_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 SignedIdentifier_STATUS instances for property testing - lazily instantiated by
// SignedIdentifier_STATUSGenerator()
var signedIdentifier_STATUSGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSignedIdentifier_STATUS(generators)
	signedIdentifier_STATUSGenerator = gen.Struct(reflect.TypeOf(SignedIdentifier_STATUS{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSignedIdentifier_STATUS(generators)
	AddRelatedPropertyGeneratorsForSignedIdentifier_STATUS(generators)
	signedIdentifier_STATUSGenerator = gen.Struct(reflect.TypeOf(SignedIdentifier_STATUS{}), generators)

	return signedIdentifier_STATUSGenerator
}

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

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

func Test_StorageAccountsFileServicesShare_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 StorageAccountsFileServicesShare_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForStorageAccountsFileServicesShare_STATUS, StorageAccountsFileServicesShare_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual StorageAccountsFileServicesShare_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 StorageAccountsFileServicesShare_STATUS instances for property testing - lazily instantiated by
// StorageAccountsFileServicesShare_STATUSGenerator()
var storageAccountsFileServicesShare_STATUSGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForStorageAccountsFileServicesShare_STATUS(generators)
	storageAccountsFileServicesShare_STATUSGenerator = gen.Struct(reflect.TypeOf(StorageAccountsFileServicesShare_STATUS{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForStorageAccountsFileServicesShare_STATUS(generators)
	AddRelatedPropertyGeneratorsForStorageAccountsFileServicesShare_STATUS(generators)
	storageAccountsFileServicesShare_STATUSGenerator = gen.Struct(reflect.TypeOf(StorageAccountsFileServicesShare_STATUS{}), generators)

	return storageAccountsFileServicesShare_STATUSGenerator
}

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

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