Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Commit

Permalink
Added new test scenarios for websocket (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhkimnew authored Sep 12, 2017
1 parent a732b10 commit c5f59e0
Show file tree
Hide file tree
Showing 23 changed files with 1,544 additions and 141 deletions.
17 changes: 16 additions & 1 deletion AspNetCoreModule.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26224.1
VisualStudioVersion = 15.0.26815.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCore\AspNetCore.vcxproj", "{439824F9-1455-4CC4-BD79-B44FA0A16552}"
ProjectSection(ProjectDependencies) = postProject
Expand All @@ -23,6 +23,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
NuGet.Config = NuGet.Config
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebSocketClientEXE", "test\WebSocketClientEXE\WebSocketClientEXE.csproj", "{4062EA94-75F5-4691-86DC-C8594BA896DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -77,6 +79,18 @@ Global
{030225D8-4EE8-47E5-B692-2A96B3B51A38}.Release|Win32.Build.0 = Release|Any CPU
{030225D8-4EE8-47E5-B692-2A96B3B51A38}.Release|x64.ActiveCfg = Release|Any CPU
{030225D8-4EE8-47E5-B692-2A96B3B51A38}.Release|x64.Build.0 = Release|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Debug|Win32.ActiveCfg = Debug|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Debug|Win32.Build.0 = Debug|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Debug|x64.ActiveCfg = Debug|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Debug|x64.Build.0 = Debug|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Release|Any CPU.Build.0 = Release|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Release|Win32.ActiveCfg = Release|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Release|Win32.Build.0 = Release|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Release|x64.ActiveCfg = Release|Any CPU
{4062EA94-75F5-4691-86DC-C8594BA896DE}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -86,5 +100,6 @@ Global
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE} = {FDD2EDF8-1B62-4978-9815-9D95260B8B91}
{4DDA7560-AA29-4161-A5EA-A7E8F3997321} = {02F461DC-5166-4E88-AAD5-CF110016A647}
{030225D8-4EE8-47E5-B692-2A96B3B51A38} = {02F461DC-5166-4E88-AAD5-CF110016A647}
{4062EA94-75F5-4691-86DC-C8594BA896DE} = {02F461DC-5166-4E88-AAD5-CF110016A647}
EndGlobalSection
EndGlobal
14 changes: 10 additions & 4 deletions test/AspNetCoreModule.Test/AspNetCoreModule.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>net46</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>AspNetCoreModule.Test</AssemblyName>
</PropertyGroup>

<ItemGroup>
Expand All @@ -21,8 +22,8 @@
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0-*" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="xunit" Version="2.3.0-beta3-build3705" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta3-build3705" />
<PackageReference Include="Microsoft.Web.Administration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(AspNetCoreVersion)" />
Expand All @@ -44,8 +45,13 @@
<Reference Include="System.ServiceProcess" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Management.Automation" />
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
<Folder Include="Properties\" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions test/AspNetCoreModule.Test/Framework/IISConfigUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ public static bool BackupAppHostConfig(string fileExtenstion, bool overWriteMode
return result;
}

public static void RestoreAppHostConfig(string fileExtenstion, bool overWriteMode)
{
string tofile = Strings.AppHostConfigPath;
string fromfile = Strings.AppHostConfigPath + fileExtenstion;
if (File.Exists(fromfile))
{
try
{
TestUtility.FileCopy(fromfile, tofile, overWrite:overWriteMode);
}
catch
{
TestUtility.LogInformation("Failed to Restore applicationhost.config");
throw;
}
}
}

public static void RestoreAppHostConfig(bool restoreFromMasterBackupFile = true)
{
string masterBackupFileExtension = ".ancmtest.masterbackup";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class InitializeTestMachine : IDisposable
public const string ANCMTestFlagsDefaultContext = "AdminAnd64Bit";
public const string ANCMTestFlagsTestSkipContext = "SkipTest";
public const string ANCMTestFlagsUsePrivateAspNetCoreFileContext = "UsePrivate";
public const string ANCMTestFlagsUseIISExpressContext = "UseIISExpress";
private const string ANCMTestFlagsUseIISExpressContext = "UseIISExpress";

private static bool? _usePrivateAspNetCoreFile = null;
public static bool? UsePrivateAspNetCoreFile
Expand Down
44 changes: 42 additions & 2 deletions test/AspNetCoreModule.Test/Framework/TestUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,47 @@ public static string RunPowershellScript(string scriptText)

return stringBuilder.ToString().Trim(new char[] { ' ', '\r', '\n' });
}


public static void RunPowershellScript(string scriptText, string expectedResult, int retryCount = 3)
{
bool isReady = false;
string result = string.Empty;

for (int i = 0; i < retryCount; i++)
{
try
{
result = TestUtility.RunPowershellScript(scriptText);
}
catch
{
result = "ExceptionError";
}

if (expectedResult != null)
{
if (expectedResult == result)
{
isReady = true;
break;
}
else
{
System.Threading.Thread.Sleep(1000);
}
}
else
{
isReady = true;
break;
}
}
if (!isReady)
{
throw new ApplicationException("Failed to execute command: " + scriptText + ", expected result: " + expectedResult + ", actual result = " + result);
}
}

public static int RunCommand(string fileName, string arguments = null, bool checkStandardError = true, bool waitForExit=true)
{
int pid = -1;
Expand All @@ -809,7 +849,7 @@ public static int RunCommand(string fileName, string arguments = null, bool chec
}

p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
pid = p.Id;
string standardOutput = string.Empty;
Expand Down
Loading

0 comments on commit c5f59e0

Please sign in to comment.