// 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_GitHubActionCodeConfiguration_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 GitHubActionCodeConfiguration_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForGitHubActionCodeConfiguration_STATUS, GitHubActionCodeConfiguration_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual GitHubActionCodeConfiguration_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 GitHubActionCodeConfiguration_STATUS instances for property testing - lazily instantiated by
// GitHubActionCodeConfiguration_STATUSGenerator()
var gitHubActionCodeConfiguration_STATUSGenerator gopter.Gen

// GitHubActionCodeConfiguration_STATUSGenerator returns a generator of GitHubActionCodeConfiguration_STATUS instances for property testing.
func GitHubActionCodeConfiguration_STATUSGenerator() gopter.Gen {
	if gitHubActionCodeConfiguration_STATUSGenerator != nil {
		return gitHubActionCodeConfiguration_STATUSGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForGitHubActionCodeConfiguration_STATUS(generators)
	gitHubActionCodeConfiguration_STATUSGenerator = gen.Struct(reflect.TypeOf(GitHubActionCodeConfiguration_STATUS{}), generators)

	return gitHubActionCodeConfiguration_STATUSGenerator
}

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

func Test_GitHubActionConfiguration_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 GitHubActionConfiguration_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForGitHubActionConfiguration_STATUS, GitHubActionConfiguration_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual GitHubActionConfiguration_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 GitHubActionConfiguration_STATUS instances for property testing - lazily instantiated by
// GitHubActionConfiguration_STATUSGenerator()
var gitHubActionConfiguration_STATUSGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForGitHubActionConfiguration_STATUS(generators)
	gitHubActionConfiguration_STATUSGenerator = gen.Struct(reflect.TypeOf(GitHubActionConfiguration_STATUS{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForGitHubActionConfiguration_STATUS(generators)
	AddRelatedPropertyGeneratorsForGitHubActionConfiguration_STATUS(generators)
	gitHubActionConfiguration_STATUSGenerator = gen.Struct(reflect.TypeOf(GitHubActionConfiguration_STATUS{}), generators)

	return gitHubActionConfiguration_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForGitHubActionConfiguration_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForGitHubActionConfiguration_STATUS(gens map[string]gopter.Gen) {
	gens["GenerateWorkflowFile"] = gen.PtrOf(gen.Bool())
	gens["IsLinux"] = gen.PtrOf(gen.Bool())
}

// AddRelatedPropertyGeneratorsForGitHubActionConfiguration_STATUS is a factory method for creating gopter generators
func AddRelatedPropertyGeneratorsForGitHubActionConfiguration_STATUS(gens map[string]gopter.Gen) {
	gens["CodeConfiguration"] = gen.PtrOf(GitHubActionCodeConfiguration_STATUSGenerator())
	gens["ContainerConfiguration"] = gen.PtrOf(GitHubActionContainerConfiguration_STATUSGenerator())
}

func Test_GitHubActionContainerConfiguration_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 GitHubActionContainerConfiguration_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForGitHubActionContainerConfiguration_STATUS, GitHubActionContainerConfiguration_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual GitHubActionContainerConfiguration_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 GitHubActionContainerConfiguration_STATUS instances for property testing - lazily instantiated by
// GitHubActionContainerConfiguration_STATUSGenerator()
var gitHubActionContainerConfiguration_STATUSGenerator gopter.Gen

// GitHubActionContainerConfiguration_STATUSGenerator returns a generator of GitHubActionContainerConfiguration_STATUS instances for property testing.
func GitHubActionContainerConfiguration_STATUSGenerator() gopter.Gen {
	if gitHubActionContainerConfiguration_STATUSGenerator != nil {
		return gitHubActionContainerConfiguration_STATUSGenerator
	}

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForGitHubActionContainerConfiguration_STATUS(generators)
	gitHubActionContainerConfiguration_STATUSGenerator = gen.Struct(reflect.TypeOf(GitHubActionContainerConfiguration_STATUS{}), generators)

	return gitHubActionContainerConfiguration_STATUSGenerator
}

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

func Test_SitesSourcecontrol_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 SitesSourcecontrol_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSitesSourcecontrol_STATUS, SitesSourcecontrol_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual SitesSourcecontrol_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 SitesSourcecontrol_STATUS instances for property testing - lazily instantiated by
// SitesSourcecontrol_STATUSGenerator()
var sitesSourcecontrol_STATUSGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSitesSourcecontrol_STATUS(generators)
	sitesSourcecontrol_STATUSGenerator = gen.Struct(reflect.TypeOf(SitesSourcecontrol_STATUS{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSitesSourcecontrol_STATUS(generators)
	AddRelatedPropertyGeneratorsForSitesSourcecontrol_STATUS(generators)
	sitesSourcecontrol_STATUSGenerator = gen.Struct(reflect.TypeOf(SitesSourcecontrol_STATUS{}), generators)

	return sitesSourcecontrol_STATUSGenerator
}

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

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

func Test_Sites_Sourcecontrol_Properties_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 Sites_Sourcecontrol_Properties_STATUS via JSON returns original",
		prop.ForAll(RunJSONSerializationTestForSites_Sourcecontrol_Properties_STATUS, Sites_Sourcecontrol_Properties_STATUSGenerator()))
	properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout))
}

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

	// Deserialize back into memory
	var actual Sites_Sourcecontrol_Properties_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 Sites_Sourcecontrol_Properties_STATUS instances for property testing - lazily instantiated by
// Sites_Sourcecontrol_Properties_STATUSGenerator()
var sites_Sourcecontrol_Properties_STATUSGenerator gopter.Gen

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

	generators := make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSites_Sourcecontrol_Properties_STATUS(generators)
	sites_Sourcecontrol_Properties_STATUSGenerator = gen.Struct(reflect.TypeOf(Sites_Sourcecontrol_Properties_STATUS{}), generators)

	// The above call to gen.Struct() captures the map, so create a new one
	generators = make(map[string]gopter.Gen)
	AddIndependentPropertyGeneratorsForSites_Sourcecontrol_Properties_STATUS(generators)
	AddRelatedPropertyGeneratorsForSites_Sourcecontrol_Properties_STATUS(generators)
	sites_Sourcecontrol_Properties_STATUSGenerator = gen.Struct(reflect.TypeOf(Sites_Sourcecontrol_Properties_STATUS{}), generators)

	return sites_Sourcecontrol_Properties_STATUSGenerator
}

// AddIndependentPropertyGeneratorsForSites_Sourcecontrol_Properties_STATUS is a factory method for creating gopter generators
func AddIndependentPropertyGeneratorsForSites_Sourcecontrol_Properties_STATUS(gens map[string]gopter.Gen) {
	gens["Branch"] = gen.PtrOf(gen.AlphaString())
	gens["DeploymentRollbackEnabled"] = gen.PtrOf(gen.Bool())
	gens["IsGitHubAction"] = gen.PtrOf(gen.Bool())
	gens["IsManualIntegration"] = gen.PtrOf(gen.Bool())
	gens["IsMercurial"] = gen.PtrOf(gen.Bool())
	gens["RepoUrl"] = gen.PtrOf(gen.AlphaString())
}

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