bool FRevertTest::RunTest(const FString& Parameters)
{
	// parameter is the provider we want to use followed by the filename
	const FString Delimiter(TEXT(" "));
	TArray<FString> ParamArray;
	Parameters.ParseIntoArray(&ParamArray, *Delimiter, true);
	ensure(ParamArray.Num() == 2);

	ADD_LATENT_AUTOMATION_COMMAND(FSetProviderLatentCommand(FName(*ParamArray[0])));
	ADD_LATENT_AUTOMATION_COMMAND(FConnectLatentCommand(FAsyncCommandHelper()));

	struct Local
	{
		static void AddDepedentCommands(const FString& InParameter)
		{
			ADD_LATENT_AUTOMATION_COMMAND(FMarkForAddLatentCommand(FAsyncCommandHelper(InParameter)));
			ADD_LATENT_AUTOMATION_COMMAND(FRevertLatentCommand(FAsyncCommandHelper(InParameter)));
			ADD_LATENT_AUTOMATION_COMMAND(FDeletePackageLatentCommand(InParameter));
		}
	};

	ADD_LATENT_AUTOMATION_COMMAND(FCreatePackageLatentCommand(FLatentCommandChain(ParamArray[1], FAddLatentCommands::CreateStatic(&Local::AddDepedentCommands))))

	return true;
}
bool FConnectTest::RunTest(const FString& Parameters)
{
	// parameter is the provider we want to use
	ADD_LATENT_AUTOMATION_COMMAND(FSetProviderLatentCommand(FName(*Parameters)));
	ADD_LATENT_AUTOMATION_COMMAND(FConnectLatentCommand(FAsyncCommandHelper()));

	return true;
}
bool FGetLabelTest::RunTest(const FString& Parameters)
{
	// parameter is the provider we want to use followed by the label
	const FString Delimiter(TEXT(" "));
	TArray<FString> ParamArray;
	Parameters.ParseIntoArray(&ParamArray, *Delimiter, true);
	ensure(ParamArray.Num() == 2);

	ADD_LATENT_AUTOMATION_COMMAND(FSetProviderLatentCommand(FName(*ParamArray[0])));
	ADD_LATENT_AUTOMATION_COMMAND(FConnectLatentCommand(FAsyncCommandHelper()));
	ADD_LATENT_AUTOMATION_COMMAND(FGetLabelLatentCommand(FLabelAndFilename(ParamArray[1], TEXT("../../../Engine/Source/Developer/SourceControl/SourceControl.Build.cs"))));

	return true;
}
bool FSyncTest::RunTest(const FString& Parameters)
{
	// parameter is the provider we want to use followed by the filename
	const FString Delimiter(TEXT(" "));
	TArray<FString> ParamArray;
	Parameters.ParseIntoArray(&ParamArray, *Delimiter, true);
	ensure(ParamArray.Num() == 2);

	ADD_LATENT_AUTOMATION_COMMAND(FSetProviderLatentCommand(FName(*ParamArray[0])));
	ADD_LATENT_AUTOMATION_COMMAND(FConnectLatentCommand(FAsyncCommandHelper()));
	ADD_LATENT_AUTOMATION_COMMAND(FSyncLatentCommand(FAsyncCommandHelper(ParamArray[1])));

	return true;
}
bool FGetRevisionTest::RunTest(const FString& Parameters)
{
	// parameter is the provider we want to use followed by the filename
	const FString Delimiter(TEXT(" "));
	TArray<FString> ParamArray;
	Parameters.ParseIntoArray(ParamArray, *Delimiter, true);
	ensure(ParamArray.Num() == 2);

	ADD_LATENT_AUTOMATION_COMMAND(FSetProviderLatentCommand(FName(*ParamArray[0])));
	ADD_LATENT_AUTOMATION_COMMAND(FConnectLatentCommand(SourceControlAutomationCommon::FAsyncCommandHelper()));
	ADD_LATENT_AUTOMATION_COMMAND(FUpdateStatusLatentCommand(SourceControlAutomationCommon::FAsyncCommandHelper(ParamArray[1])));
	ADD_LATENT_AUTOMATION_COMMAND(FGetRevisionLatentCommand(ParamArray[1]));

	return true;
}
bool FSyncLabelTest::RunTest(const FString& Parameters)
{
	// parameter is the provider we want to use followed by the label
	const FString Delimiter(TEXT(" "));
	TArray<FString> ParamArray;
	Parameters.ParseIntoArray(ParamArray, *Delimiter, true);
	ensure(ParamArray.Num() == 2);

	TArray<FString> FilesToGet;
	FilesToGet.Add(FPaths::ConvertRelativePathToFull(TEXT("../../../Engine/Source/Developer/SourceControl/SourceControl.Build.cs")));
	FilesToGet.Add(FPaths::ConvertRelativePathToFull(TEXT("../../../Engine/Source/Developer/SourceControl/Public/ISourceControlModule.h")));

	ADD_LATENT_AUTOMATION_COMMAND(FSetProviderLatentCommand(FName(*ParamArray[0])));
	ADD_LATENT_AUTOMATION_COMMAND(FConnectLatentCommand(SourceControlAutomationCommon::FAsyncCommandHelper()));
	ADD_LATENT_AUTOMATION_COMMAND(FSyncLabelLatentCommand(FLabelAndFilenames(ParamArray[1], FilesToGet)));

	return true;
}
bool FCheckOutTest::RunTest(const FString& Parameters)
{
	// parameter is the provider we want to use followed by the filename
	const FString Delimiter(TEXT(" "));
	TArray<FString> ParamArray;
	Parameters.ParseIntoArray(&ParamArray, *Delimiter, true);
	ensure(ParamArray.Num() == 2);

	// check to see if we should restore the read only status after this test
	bool bWasReadOnly = IFileManager::Get().IsReadOnly(*SourceControlHelpers::PackageFilename(ParamArray[1]));

	ADD_LATENT_AUTOMATION_COMMAND(FSetProviderLatentCommand(FName(*ParamArray[0])));
	ADD_LATENT_AUTOMATION_COMMAND(FConnectLatentCommand(FAsyncCommandHelper()));
	ADD_LATENT_AUTOMATION_COMMAND(FCheckOutLatentCommand(FAsyncCommandHelper(ParamArray[1])));
	ADD_LATENT_AUTOMATION_COMMAND(FRevertLatentCommand(FAsyncCommandHelper(ParamArray[1])));

	ADD_LATENT_AUTOMATION_COMMAND(FSetReadOnlyFlag(FReadOnlyState(ParamArray[1], bWasReadOnly)));

	return true;
}