Logging API changes
This commit is contained in:
parent
a1e5048a0a
commit
c230aa23e1
File diff suppressed because it is too large
Load Diff
|
|
@ -13,7 +13,7 @@ namespace E2ETests
|
|||
{
|
||||
try
|
||||
{
|
||||
logger.WriteInformation("Trying to drop database '{0}'", databaseName);
|
||||
logger.LogInformation("Trying to drop database '{0}'", databaseName);
|
||||
using (var conn = new SqlConnection(@"Server=(localdb)\MSSQLLocalDB;Database=master;Trusted_Connection=True;"))
|
||||
{
|
||||
conn.Open();
|
||||
|
|
@ -26,13 +26,13 @@ namespace E2ETests
|
|||
END", databaseName);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
logger.WriteInformation("Successfully dropped database {0}", databaseName);
|
||||
logger.LogInformation("Successfully dropped database {0}", databaseName);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
//Ignore if there is failure in cleanup.
|
||||
logger.WriteWarning("Error occured while dropping database {0}. Exception : {1}", databaseName, exception.ToString());
|
||||
logger.LogWarning("Error occured while dropping database {0}. Exception : {1}", databaseName, exception.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,19 +105,19 @@ namespace E2ETests
|
|||
KpmBundle(startParameters, logger, Path.Combine(Environment.GetEnvironmentVariable("SystemDrive") + @"\", @"inetpub\wwwroot"));
|
||||
|
||||
// Drop a Microsoft.AspNet.Hosting.ini with ASPNET_ENV information.
|
||||
logger.WriteInformation("Creating Microsoft.AspNet.Hosting.ini file with ASPNET_ENV.");
|
||||
logger.LogInformation("Creating Microsoft.AspNet.Hosting.ini file with ASPNET_ENV.");
|
||||
var iniFile = Path.Combine(startParameters.ApplicationPath, "Microsoft.AspNet.Hosting.ini");
|
||||
File.WriteAllText(iniFile, string.Format("ASPNET_ENV={0}", startParameters.EnvironmentName));
|
||||
|
||||
// Can't use localdb with IIS. Setting an override to use InMemoryStore.
|
||||
logger.WriteInformation("Creating configoverride.json file to override default config.");
|
||||
logger.LogInformation("Creating configoverride.json file to override default config.");
|
||||
var overrideConfig = Path.Combine(startParameters.ApplicationPath, "..", "approot", "src", "MusicStore", "configoverride.json");
|
||||
overrideConfig = Path.GetFullPath(overrideConfig);
|
||||
File.WriteAllText(overrideConfig, "{\"UseInMemoryStore\": \"true\"}");
|
||||
|
||||
if (startParameters.ServerType == ServerType.IISNativeModule)
|
||||
{
|
||||
logger.WriteInformation("Turning runAllManagedModulesForAllRequests=true in web.config.");
|
||||
logger.LogInformation("Turning runAllManagedModulesForAllRequests=true in web.config.");
|
||||
// Set runAllManagedModulesForAllRequests=true
|
||||
var webConfig = Path.Combine(startParameters.ApplicationPath, "web.config");
|
||||
var configuration = new XmlDocument();
|
||||
|
|
@ -134,7 +134,7 @@ namespace E2ETests
|
|||
configuration.Save(webConfig);
|
||||
}
|
||||
|
||||
logger.WriteInformation("Successfully finished IIS application directory setup.");
|
||||
logger.LogInformation("Successfully finished IIS application directory setup.");
|
||||
|
||||
Thread.Sleep(1 * 1000);
|
||||
}
|
||||
|
|
@ -189,12 +189,12 @@ namespace E2ETests
|
|||
}
|
||||
|
||||
//Mono now supports --appbase
|
||||
logger.WriteInformation("Setting the --appbase to {0}", startParameters.ApplicationPath);
|
||||
logger.LogInformation("Setting the --appbase to {0}", startParameters.ApplicationPath);
|
||||
|
||||
var bootstrapper = "klr";
|
||||
|
||||
var commandName = startParameters.ServerType == ServerType.Kestrel ? "kestrel" : string.Empty;
|
||||
logger.WriteInformation("Executing command: {klr} {appPath} {command}", bootstrapper, startParameters.ApplicationPath, commandName);
|
||||
logger.LogInformation("Executing command: {klr} {appPath} {command}", bootstrapper, startParameters.ApplicationPath, commandName);
|
||||
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
|
|
@ -206,11 +206,11 @@ namespace E2ETests
|
|||
};
|
||||
|
||||
var hostProcess = Process.Start(startInfo);
|
||||
logger.WriteInformation("Started {0}. Process Id : {1}", hostProcess.MainModule.FileName, hostProcess.Id);
|
||||
logger.LogInformation("Started {0}. Process Id : {1}", hostProcess.MainModule.FileName, hostProcess.Id);
|
||||
|
||||
if (hostProcess.HasExited)
|
||||
{
|
||||
logger.WriteError("Host process {processName} exited with code {exitCode} or failed to start.", startInfo.FileName, hostProcess.ExitCode);
|
||||
logger.LogError("Host process {processName} exited with code {exitCode} or failed to start.", startInfo.FileName, hostProcess.ExitCode);
|
||||
throw new Exception("Failed to start host");
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ namespace E2ETests
|
|||
|
||||
var iisExpressPath = GetIISExpressPath(startParameters.RuntimeArchitecture);
|
||||
|
||||
logger.WriteInformation("Executing command : {iisExpress} {args}", iisExpressPath, parameters);
|
||||
logger.LogInformation("Executing command : {iisExpress} {args}", iisExpressPath, parameters);
|
||||
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
|
|
@ -260,7 +260,7 @@ namespace E2ETests
|
|||
};
|
||||
|
||||
var hostProcess = Process.Start(startInfo);
|
||||
logger.WriteInformation("Started iisexpress. Process Id : {processId}", hostProcess.Id);
|
||||
logger.LogInformation("Started iisexpress. Process Id : {processId}", hostProcess.Id);
|
||||
|
||||
return hostProcess;
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ namespace E2ETests
|
|||
private static Process StartSelfHost(StartParameters startParameters, ILogger logger)
|
||||
{
|
||||
var commandName = startParameters.ServerType == ServerType.WebListener ? "web" : "kestrel";
|
||||
logger.WriteInformation("Executing klr.exe --appbase {appPath} \"Microsoft.Framework.ApplicationHost\" {command}", startParameters.ApplicationPath, commandName);
|
||||
logger.LogInformation("Executing klr.exe --appbase {appPath} \"Microsoft.Framework.ApplicationHost\" {command}", startParameters.ApplicationPath, commandName);
|
||||
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
|
|
@ -284,17 +284,17 @@ namespace E2ETests
|
|||
|
||||
if (hostProcess.HasExited)
|
||||
{
|
||||
logger.WriteError("Host process {processName} exited with code {exitCode} or failed to start.", startInfo.FileName, hostProcess.ExitCode);
|
||||
logger.LogError("Host process {processName} exited with code {exitCode} or failed to start.", startInfo.FileName, hostProcess.ExitCode);
|
||||
throw new Exception("Failed to start host");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
logger.WriteInformation("Started {fileName}. Process Id : {processId}", hostProcess.MainModule.FileName, hostProcess.Id);
|
||||
logger.LogInformation("Started {fileName}. Process Id : {processId}", hostProcess.MainModule.FileName, hostProcess.Id);
|
||||
}
|
||||
catch (Win32Exception win32Exception)
|
||||
{
|
||||
logger.WriteWarning("Cannot access 64 bit modules from a 32 bit process. Failed with following message.", win32Exception);
|
||||
logger.LogWarning("Cannot access 64 bit modules from a 32 bit process. Failed with following message.", win32Exception);
|
||||
}
|
||||
|
||||
return hostProcess;
|
||||
|
|
@ -303,8 +303,8 @@ namespace E2ETests
|
|||
private static string SwitchPathToRuntimeFlavor(RuntimeFlavor runtimeFlavor, RuntimeArchitecture runtimeArchitecture, ILogger logger)
|
||||
{
|
||||
var pathValue = Environment.GetEnvironmentVariable("PATH");
|
||||
logger.WriteInformation(string.Empty);
|
||||
logger.WriteInformation("Current %PATH% value : {0}", pathValue);
|
||||
logger.LogInformation(string.Empty);
|
||||
logger.LogInformation("Current %PATH% value : {0}", pathValue);
|
||||
|
||||
var replaceStr = new StringBuilder().
|
||||
Append("kre").
|
||||
|
|
@ -322,8 +322,8 @@ namespace E2ETests
|
|||
// Tweak the %PATH% to the point to the right RUNTIMEFLAVOR.
|
||||
Environment.SetEnvironmentVariable("PATH", pathValue);
|
||||
|
||||
logger.WriteInformation(string.Empty);
|
||||
logger.WriteInformation("Changing to use runtime : {runtime}", runtimeName);
|
||||
logger.LogInformation(string.Empty);
|
||||
logger.LogInformation("Changing to use runtime : {runtime}", runtimeName);
|
||||
return runtimeName;
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ namespace E2ETests
|
|||
startParameters.BundledApplicationRootPath = Path.Combine(bundleRoot ?? Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
|
||||
var parameters = string.Format("bundle {0} -o {1} --runtime {2}", startParameters.ApplicationPath, startParameters.BundledApplicationRootPath, startParameters.Runtime);
|
||||
logger.WriteInformation("Executing command kpm {args}", parameters);
|
||||
logger.LogInformation("Executing command kpm {args}", parameters);
|
||||
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
|
|
@ -352,7 +352,7 @@ namespace E2ETests
|
|||
Path.Combine(startParameters.BundledApplicationRootPath, "wwwroot") :
|
||||
Path.Combine(startParameters.BundledApplicationRootPath, "approot", "src", "MusicStore");
|
||||
|
||||
logger.WriteInformation("kpm bundle finished with exit code : {exitCode}", hostProcess.ExitCode);
|
||||
logger.LogInformation("kpm bundle finished with exit code : {exitCode}", hostProcess.ExitCode);
|
||||
}
|
||||
|
||||
public static void CleanUpApplication(StartParameters startParameters, Process hostProcess, string musicStoreDbName, ILogger logger)
|
||||
|
|
@ -375,16 +375,16 @@ namespace E2ETests
|
|||
hostProcess.WaitForExit(5 * 1000);
|
||||
if (!hostProcess.HasExited)
|
||||
{
|
||||
logger.WriteWarning("Unable to terminate the host process with process Id '{processId}", hostProcess.Id);
|
||||
logger.LogWarning("Unable to terminate the host process with process Id '{processId}", hostProcess.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.WriteInformation("Successfully terminated host process with process Id '{processId}'", hostProcess.Id);
|
||||
logger.LogInformation("Successfully terminated host process with process Id '{processId}'", hostProcess.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.WriteWarning("Host process already exited or never started successfully.");
|
||||
logger.LogWarning("Host process already exited or never started successfully.");
|
||||
}
|
||||
|
||||
if (!Helpers.RunningOnMono)
|
||||
|
|
@ -405,7 +405,7 @@ namespace E2ETests
|
|||
catch (Exception exception)
|
||||
{
|
||||
//Ignore delete failures - just write a log
|
||||
logger.WriteWarning("Failed to delete '{config}'. Exception : {exception}", startParameters.ApplicationHostConfigLocation, exception.Message);
|
||||
logger.LogWarning("Failed to delete '{config}'. Exception : {exception}", startParameters.ApplicationHostConfigLocation, exception.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -419,7 +419,7 @@ namespace E2ETests
|
|||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.WriteWarning("Failed to delete directory.", exception);
|
||||
logger.LogWarning("Failed to delete directory.", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace E2ETests
|
|||
{
|
||||
try
|
||||
{
|
||||
logger.WriteWarning("Retry count {retryCount}..", retry + 1);
|
||||
logger.LogWarning("Retry count {retryCount}..", retry + 1);
|
||||
retryBlock();
|
||||
break; //Went through successfully
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ namespace E2ETests
|
|||
#endif
|
||||
)
|
||||
{
|
||||
logger.WriteWarning("Failed to complete the request.", exception);
|
||||
logger.LogWarning("Failed to complete the request.", exception);
|
||||
Thread.Sleep(7 * 1000); //Wait for a while before retry.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace E2ETests
|
|||
applicationPool.ManagedRuntimeVersion = NATIVE_MODULE_MANAGED_RUNTIME_VERSION;
|
||||
}
|
||||
applicationPool.Enable32BitAppOnWin64 = (_startParameters.RuntimeArchitecture == RuntimeArchitecture.x86);
|
||||
_logger.WriteInformation("Created {bit} application pool '{name}' with runtime version '{runtime}'.",
|
||||
_logger.LogInformation("Created {bit} application pool '{name}' with runtime version '{runtime}'.",
|
||||
_startParameters.RuntimeArchitecture, applicationPool.Name,
|
||||
applicationPool.ManagedRuntimeVersion ?? "default");
|
||||
return applicationPool;
|
||||
|
|
@ -67,14 +67,14 @@ namespace E2ETests
|
|||
|
||||
public void StopAndDeleteAppPool()
|
||||
{
|
||||
_logger.WriteInformation("Stopping application pool '{name}' and deleting application.", _applicationPool.Name);
|
||||
_logger.LogInformation("Stopping application pool '{name}' and deleting application.", _applicationPool.Name);
|
||||
_applicationPool.Stop();
|
||||
// Remove the application from website.
|
||||
_application = Website.Applications.Where(a => a.Path == _application.Path).FirstOrDefault();
|
||||
Website.Applications.Remove(_application);
|
||||
_serverManager.ApplicationPools.Remove(_serverManager.ApplicationPools[_applicationPool.Name]);
|
||||
_serverManager.CommitChanges();
|
||||
_logger.WriteInformation("Successfully stopped application pool '{name}' and deleted application from IIS.", _applicationPool.Name);
|
||||
_logger.LogInformation("Successfully stopped application pool '{name}' and deleted application from IIS.", _applicationPool.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace E2ETests
|
|||
var response = _httpClient.GetAsync("Account/Login").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Signing in with Facebook account");
|
||||
_logger.LogInformation("Signing in with Facebook account");
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("provider", "Facebook"),
|
||||
|
|
@ -85,14 +85,14 @@ namespace E2ETests
|
|||
//Verify cookie sent
|
||||
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.ExternalLogin"));
|
||||
_logger.WriteInformation("Successfully signed in with user '{email}'", "AspnetvnextTest@test.com");
|
||||
_logger.LogInformation("Successfully signed in with user '{email}'", "AspnetvnextTest@test.com");
|
||||
|
||||
_logger.WriteInformation("Verifying if the middleware notifications were fired");
|
||||
_logger.LogInformation("Verifying if the middleware notifications were fired");
|
||||
//Check for a non existing item
|
||||
response = _httpClient.GetAsync(string.Format("Admin/StoreManager/GetAlbumIdFromName?albumName={0}", "123")).Result;
|
||||
//This action requires admin permissions. If notifications are fired this permission is granted
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
_logger.WriteInformation("Middleware notifications were fired successfully");
|
||||
_logger.LogInformation("Middleware notifications were fired successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ namespace E2ETests
|
|||
var response = _httpClient.GetAsync("Account/Login").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Signing in with Google account");
|
||||
_logger.LogInformation("Signing in with Google account");
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("provider", "Google"),
|
||||
|
|
@ -86,15 +86,15 @@ namespace E2ETests
|
|||
//Verify cookie sent
|
||||
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.ExternalLogin"));
|
||||
_logger.WriteInformation("Successfully signed in with user '{email}'", "AspnetvnextTest@gmail.com");
|
||||
_logger.LogInformation("Successfully signed in with user '{email}'", "AspnetvnextTest@gmail.com");
|
||||
|
||||
_logger.WriteInformation("Verifying if the middleware notifications were fired");
|
||||
_logger.LogInformation("Verifying if the middleware notifications were fired");
|
||||
//Check for a non existing item
|
||||
response = _httpClient.GetAsync(string.Format("Admin/StoreManager/GetAlbumIdFromName?albumName={0}", "123")).Result;
|
||||
//This action requires admin permissions. If notifications are fired this permission is granted
|
||||
_logger.WriteVerbose(response.Content.ReadAsStringAsync().Result);
|
||||
_logger.LogVerbose(response.Content.ReadAsStringAsync().Result);
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
_logger.WriteInformation("Middleware notifications were fired successfully");
|
||||
_logger.LogInformation("Middleware notifications were fired successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ namespace E2ETests
|
|||
var response = _httpClient.GetAsync("Account/Login").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Signing in with Microsoft account");
|
||||
_logger.LogInformation("Signing in with Microsoft account");
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("provider", "Microsoft"),
|
||||
|
|
@ -85,15 +85,15 @@ namespace E2ETests
|
|||
//Verify cookie sent
|
||||
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.ExternalLogin"));
|
||||
_logger.WriteInformation("Successfully signed in with user '{email}'", "microsoft@test.com");
|
||||
_logger.LogInformation("Successfully signed in with user '{email}'", "microsoft@test.com");
|
||||
|
||||
_logger.WriteInformation("Verifying if the middleware notifications were fired");
|
||||
_logger.LogInformation("Verifying if the middleware notifications were fired");
|
||||
//Check for a non existing item
|
||||
response = _httpClient.GetAsync(string.Format("Admin/StoreManager/GetAlbumIdFromName?albumName={0}", "123")).Result;
|
||||
//This action requires admin permissions. If notifications are fired this permission is granted
|
||||
_logger.WriteInformation(response.Content.ReadAsStringAsync().Result);
|
||||
_logger.LogInformation(response.Content.ReadAsStringAsync().Result);
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
_logger.WriteInformation("Middleware notifications were fired successfully");
|
||||
_logger.LogInformation("Middleware notifications were fired successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ namespace E2ETests
|
|||
var response = _httpClient.GetAsync("Account/Login").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Signing in with OpenIdConnect account");
|
||||
_logger.LogInformation("Signing in with OpenIdConnect account");
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("provider", "OpenIdConnect"),
|
||||
|
|
@ -74,16 +74,16 @@ namespace E2ETests
|
|||
//Verify cookie sent
|
||||
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.ExternalLogin"));
|
||||
_logger.WriteInformation("Successfully signed in with user '{email}'", "User3@aspnettest.onmicrosoft.com");
|
||||
_logger.LogInformation("Successfully signed in with user '{email}'", "User3@aspnettest.onmicrosoft.com");
|
||||
|
||||
_logger.WriteInformation("Verifying if the middleware notifications were fired");
|
||||
_logger.LogInformation("Verifying if the middleware notifications were fired");
|
||||
//Check for a non existing item
|
||||
response = _httpClient.GetAsync(string.Format("Admin/StoreManager/GetAlbumIdFromName?albumName={0}", "123")).Result;
|
||||
//This action requires admin permissions. If notifications are fired this permission is granted
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
_logger.WriteInformation("Middleware notifications were fired successfully");
|
||||
_logger.LogInformation("Middleware notifications were fired successfully");
|
||||
|
||||
_logger.WriteInformation("Verifying the OpenIdConnect logout flow..");
|
||||
_logger.LogInformation("Verifying the OpenIdConnect logout flow..");
|
||||
response = _httpClient.GetAsync(string.Empty).Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
|
|
|
|||
|
|
@ -13,24 +13,24 @@ namespace E2ETests
|
|||
{
|
||||
private void VerifyStaticContentServed()
|
||||
{
|
||||
_logger.WriteInformation("Validating if static contents are served..");
|
||||
_logger.WriteInformation("Fetching favicon.ico..");
|
||||
_logger.LogInformation("Validating if static contents are served..");
|
||||
_logger.LogInformation("Fetching favicon.ico..");
|
||||
var response = _httpClient.GetAsync("favicon.ico").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
_logger.WriteInformation("Etag received: {etag}", response.Headers.ETag.Tag);
|
||||
_logger.LogInformation("Etag received: {etag}", response.Headers.ETag.Tag);
|
||||
|
||||
//Check if you receive a NotModified on sending an etag
|
||||
_logger.WriteInformation("Sending an IfNoneMatch header with e-tag");
|
||||
_logger.LogInformation("Sending an IfNoneMatch header with e-tag");
|
||||
_httpClient.DefaultRequestHeaders.IfNoneMatch.Add(response.Headers.ETag);
|
||||
response = _httpClient.GetAsync("favicon.ico").Result;
|
||||
Assert.Equal(HttpStatusCode.NotModified, response.StatusCode);
|
||||
_httpClient.DefaultRequestHeaders.IfNoneMatch.Clear();
|
||||
_logger.WriteInformation("Successfully received a NotModified status");
|
||||
_logger.LogInformation("Successfully received a NotModified status");
|
||||
|
||||
_logger.WriteInformation("Fetching /Content/bootstrap.css..");
|
||||
_logger.LogInformation("Fetching /Content/bootstrap.css..");
|
||||
response = _httpClient.GetAsync("Content/bootstrap.css").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
_logger.WriteInformation("Verified static contents are served successfully");
|
||||
_logger.LogInformation("Verified static contents are served successfully");
|
||||
}
|
||||
|
||||
private void VerifyHomePage(HttpResponseMessage response, string responseContent, bool useNtlmAuthentication = false)
|
||||
|
|
@ -53,13 +53,13 @@ namespace E2ETests
|
|||
|
||||
Assert.Contains("www.github.com/aspnet/MusicStore", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains("/Images/home-showcase.png", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
_logger.WriteInformation("Application initialization successful.");
|
||||
_logger.LogInformation("Application initialization successful.");
|
||||
|
||||
_logger.WriteInformation("Application runtime information");
|
||||
_logger.LogInformation("Application runtime information");
|
||||
var runtimeResponse = _httpClient.GetAsync("runtimeinfo").Result;
|
||||
ThrowIfResponseStatusNotOk(runtimeResponse);
|
||||
var runtimeInfo = runtimeResponse.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation(runtimeInfo);
|
||||
_logger.LogInformation(runtimeInfo);
|
||||
}
|
||||
|
||||
private string PrefixBaseAddress(string url)
|
||||
|
|
@ -87,7 +87,7 @@ namespace E2ETests
|
|||
|
||||
private void AccessStoreWithoutPermissions(string email = null)
|
||||
{
|
||||
_logger.WriteInformation("Trying to access StoreManager that needs ManageStore claim with the current user : {email}", email ?? "Anonymous");
|
||||
_logger.LogInformation("Trying to access StoreManager that needs ManageStore claim with the current user : {email}", email ?? "Anonymous");
|
||||
var response = _httpClient.GetAsync("Admin/StoreManager/").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
|
|
@ -95,29 +95,29 @@ namespace E2ETests
|
|||
Assert.Contains("<title>Log in – MVC Music Store</title>", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains("<h4>Use a local account to log in.</h4>", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Equal<string>(_applicationBaseUrl + PrefixBaseAddress("Account/Login?ReturnUrl=%2F{0}%2FAdmin%2FStoreManager%2F"), response.RequestMessage.RequestUri.AbsoluteUri);
|
||||
_logger.WriteInformation("Redirected to login page as expected.");
|
||||
_logger.LogInformation("Redirected to login page as expected.");
|
||||
}
|
||||
|
||||
private void AccessStoreWithPermissions()
|
||||
{
|
||||
_logger.WriteInformation("Trying to access the store inventory..");
|
||||
_logger.LogInformation("Trying to access the store inventory..");
|
||||
var response = _httpClient.GetAsync("Admin/StoreManager/").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
Assert.Equal<string>(_applicationBaseUrl + "Admin/StoreManager/", response.RequestMessage.RequestUri.AbsoluteUri);
|
||||
_logger.WriteInformation("Successfully acccessed the store inventory");
|
||||
_logger.LogInformation("Successfully acccessed the store inventory");
|
||||
}
|
||||
|
||||
private void RegisterUserWithNonMatchingPasswords()
|
||||
{
|
||||
_logger.WriteInformation("Trying to create user with not matching password and confirm password");
|
||||
_logger.LogInformation("Trying to create user with not matching password and confirm password");
|
||||
var response = _httpClient.GetAsync("Account/Register").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
ValidateLayoutPage(responseContent);
|
||||
|
||||
var generatedEmail = Guid.NewGuid().ToString().Replace("-", string.Empty) + "@test.com";
|
||||
_logger.WriteInformation("Creating a new user with name '{email}'", generatedEmail);
|
||||
_logger.LogInformation("Creating a new user with name '{email}'", generatedEmail);
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("Email", generatedEmail),
|
||||
|
|
@ -131,7 +131,7 @@ namespace E2ETests
|
|||
responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
Assert.Contains("<div class=\"validation-summary-errors text-danger\" data-valmsg-summary=\"true\"><ul><li>The password and confirmation password do not match.</li>", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
_logger.WriteInformation("Server side model validator rejected the user '{email}''s registration as passwords do not match.", generatedEmail);
|
||||
_logger.LogInformation("Server side model validator rejected the user '{email}''s registration as passwords do not match.", generatedEmail);
|
||||
}
|
||||
|
||||
private string RegisterValidUser()
|
||||
|
|
@ -142,7 +142,7 @@ namespace E2ETests
|
|||
ValidateLayoutPage(responseContent);
|
||||
|
||||
var generatedEmail = Guid.NewGuid().ToString().Replace("-", string.Empty) + "@test.com";
|
||||
_logger.WriteInformation("Creating a new user with name '{email}'", generatedEmail);
|
||||
_logger.LogInformation("Creating a new user with name '{email}'", generatedEmail);
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("Email", generatedEmail),
|
||||
|
|
@ -171,11 +171,11 @@ namespace E2ETests
|
|||
|
||||
private void RegisterExistingUser(string email)
|
||||
{
|
||||
_logger.WriteInformation("Trying to register a user with name '{email}' again", email);
|
||||
_logger.LogInformation("Trying to register a user with name '{email}' again", email);
|
||||
var response = _httpClient.GetAsync("Account/Register").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Creating a new user with name '{email}'", email);
|
||||
_logger.LogInformation("Creating a new user with name '{email}'", email);
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("Email", email),
|
||||
|
|
@ -188,12 +188,12 @@ namespace E2ETests
|
|||
response = _httpClient.PostAsync("Account/Register", content).Result;
|
||||
responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
Assert.Contains(string.Format("User name '{0}' is already taken.", email), responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
_logger.WriteInformation("Identity threw a valid exception that user '{email}' already exists in the system", email);
|
||||
_logger.LogInformation("Identity threw a valid exception that user '{email}' already exists in the system", email);
|
||||
}
|
||||
|
||||
private void SignOutUser(string email)
|
||||
{
|
||||
_logger.WriteInformation("Signing out from '{email}''s session", email);
|
||||
_logger.LogInformation("Signing out from '{email}''s session", email);
|
||||
var response = _httpClient.GetAsync(string.Empty).Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
|
|
@ -216,7 +216,7 @@ namespace E2ETests
|
|||
Assert.Contains("/Images/home-showcase.png", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
//Verify cookie cleared on logout
|
||||
Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
_logger.WriteInformation("Successfully signed out of '{email}''s session", email);
|
||||
_logger.LogInformation("Successfully signed out of '{email}''s session", email);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -231,7 +231,7 @@ namespace E2ETests
|
|||
var response = _httpClient.GetAsync("Account/Login").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Signing in with user '{email}'", email);
|
||||
_logger.LogInformation("Signing in with user '{email}'", email);
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("Email", email),
|
||||
|
|
@ -245,7 +245,7 @@ namespace E2ETests
|
|||
Assert.Contains("<div class=\"validation-summary-errors text-danger\"><ul><li>Invalid login attempt.</li>", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
//Verify cookie not sent
|
||||
Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
_logger.WriteInformation("Identity successfully prevented an invalid user login.");
|
||||
_logger.LogInformation("Identity successfully prevented an invalid user login.");
|
||||
}
|
||||
|
||||
private void SignInWithUser(string email, string password)
|
||||
|
|
@ -253,7 +253,7 @@ namespace E2ETests
|
|||
var response = _httpClient.GetAsync("Account/Login").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Signing in with user '{email}'", email);
|
||||
_logger.LogInformation("Signing in with user '{email}'", email);
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("Email", email),
|
||||
|
|
@ -268,7 +268,7 @@ namespace E2ETests
|
|||
Assert.Contains("Log off", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
//Verify cookie sent
|
||||
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
_logger.WriteInformation("Successfully signed in with user '{email}'", email);
|
||||
_logger.LogInformation("Successfully signed in with user '{email}'", email);
|
||||
}
|
||||
|
||||
private void ChangePassword(string email)
|
||||
|
|
@ -289,7 +289,7 @@ namespace E2ETests
|
|||
responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
Assert.Contains("Your password has been changed.", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
_logger.WriteInformation("Successfully changed the password for user '{email}'", email);
|
||||
_logger.LogInformation("Successfully changed the password for user '{email}'", email);
|
||||
}
|
||||
|
||||
private string CreateAlbum()
|
||||
|
|
@ -301,7 +301,7 @@ namespace E2ETests
|
|||
var hubConnection = new HubConnection(_applicationBaseUrl + "SignalR");
|
||||
hubConnection.Received += (data) =>
|
||||
{
|
||||
_logger.WriteVerbose("Data received by SignalR client: {receivedData}", data);
|
||||
_logger.LogVerbose("Data received by SignalR client: {receivedData}", data);
|
||||
dataFromHub = data;
|
||||
OnReceivedEvent.Set();
|
||||
};
|
||||
|
|
@ -309,7 +309,7 @@ namespace E2ETests
|
|||
IHubProxy proxy = hubConnection.CreateHubProxy("Announcement");
|
||||
hubConnection.Start().Wait();
|
||||
#endif
|
||||
_logger.WriteInformation("Trying to create an album with name '{album}'", albumName);
|
||||
_logger.LogInformation("Trying to create an album with name '{album}'", albumName);
|
||||
var response = _httpClient.GetAsync("Admin/StoreManager/create").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
|
|
@ -329,28 +329,28 @@ namespace E2ETests
|
|||
Assert.Equal<string>(_applicationBaseUrl + "Admin/StoreManager", response.RequestMessage.RequestUri.AbsoluteUri);
|
||||
Assert.Contains(albumName, responseContent);
|
||||
#if ASPNET50
|
||||
_logger.WriteInformation("Waiting for the SignalR client to receive album created announcement");
|
||||
_logger.LogInformation("Waiting for the SignalR client to receive album created announcement");
|
||||
OnReceivedEvent.WaitOne(TimeSpan.FromSeconds(10));
|
||||
dataFromHub = dataFromHub ?? "No relevant data received from Hub";
|
||||
Assert.Contains(albumName, dataFromHub);
|
||||
#endif
|
||||
_logger.WriteInformation("Successfully created an album with name '{album}' in the store", albumName);
|
||||
_logger.LogInformation("Successfully created an album with name '{album}' in the store", albumName);
|
||||
return albumName;
|
||||
}
|
||||
|
||||
private string FetchAlbumIdFromName(string albumName)
|
||||
{
|
||||
_logger.WriteInformation("Fetching the album id of '{album}'", albumName);
|
||||
_logger.LogInformation("Fetching the album id of '{album}'", albumName);
|
||||
var response = _httpClient.GetAsync(string.Format("Admin/StoreManager/GetAlbumIdFromName?albumName={0}", albumName)).Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var albumId = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Album id for album '{album}' is '{id}'", albumName, albumId);
|
||||
_logger.LogInformation("Album id for album '{album}' is '{id}'", albumName, albumId);
|
||||
return albumId;
|
||||
}
|
||||
|
||||
private void VerifyAlbumDetails(string albumId, string albumName)
|
||||
{
|
||||
_logger.WriteInformation("Getting details of album with Id '{id}'", albumId);
|
||||
_logger.LogInformation("Getting details of album with Id '{id}'", albumId);
|
||||
var response = _httpClient.GetAsync(string.Format("Admin/StoreManager/Details?id={0}", albumId)).Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
|
|
@ -362,7 +362,7 @@ namespace E2ETests
|
|||
|
||||
private void VerifyStatusCodePages()
|
||||
{
|
||||
_logger.WriteInformation("Getting details of a non-existing album with Id '-1'");
|
||||
_logger.LogInformation("Getting details of a non-existing album with Id '-1'");
|
||||
var response = _httpClient.GetAsync("Admin/StoreManager/Details?id=-1").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
|
|
@ -373,7 +373,7 @@ namespace E2ETests
|
|||
// This gets the view that non-admin users get to see.
|
||||
private void GetAlbumDetailsFromStore(string albumId, string albumName)
|
||||
{
|
||||
_logger.WriteInformation("Getting details of album with Id '{id}'", albumId);
|
||||
_logger.LogInformation("Getting details of album with Id '{id}'", albumId);
|
||||
var response = _httpClient.GetAsync(string.Format("Store/Details/{0}", albumId)).Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
|
|
@ -382,18 +382,18 @@ namespace E2ETests
|
|||
|
||||
private void AddAlbumToCart(string albumId, string albumName)
|
||||
{
|
||||
_logger.WriteInformation("Adding album id '{albumId}' to the cart", albumId);
|
||||
_logger.LogInformation("Adding album id '{albumId}' to the cart", albumId);
|
||||
var response = _httpClient.GetAsync(string.Format("ShoppingCart/AddToCart?id={0}", albumId)).Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
Assert.Contains(albumName, responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains("<span class=\"glyphicon glyphicon glyphicon-shopping-cart\"></span>", responseContent, StringComparison.OrdinalIgnoreCase);
|
||||
_logger.WriteInformation("Verified that album is added to cart");
|
||||
_logger.LogInformation("Verified that album is added to cart");
|
||||
}
|
||||
|
||||
private void CheckOutCartItems()
|
||||
{
|
||||
_logger.WriteInformation("Checking out the cart contents...");
|
||||
_logger.LogInformation("Checking out the cart contents...");
|
||||
var response = _httpClient.GetAsync("Checkout/AddressAndPayment").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
|
|
@ -422,7 +422,7 @@ namespace E2ETests
|
|||
|
||||
private void DeleteAlbum(string albumId, string albumName)
|
||||
{
|
||||
_logger.WriteInformation("Deleting album '{album}' from the store..", albumName);
|
||||
_logger.LogInformation("Deleting album '{album}' from the store..", albumName);
|
||||
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
|
|
@ -433,17 +433,17 @@ namespace E2ETests
|
|||
var response = _httpClient.PostAsync("Admin/StoreManager/RemoveAlbum", content).Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
|
||||
_logger.WriteInformation("Verifying if the album '{album}' is deleted from store", albumName);
|
||||
_logger.LogInformation("Verifying if the album '{album}' is deleted from store", albumName);
|
||||
response = _httpClient.GetAsync(string.Format("Admin/StoreManager/GetAlbumIdFromName?albumName={0}", albumName)).Result;
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
_logger.WriteInformation("Album '{album}' with id '{Id}' is successfully deleted from the store.", albumName, albumId);
|
||||
_logger.LogInformation("Album '{album}' with id '{Id}' is successfully deleted from the store.", albumName, albumId);
|
||||
}
|
||||
|
||||
private void ThrowIfResponseStatusNotOk(HttpResponseMessage response)
|
||||
{
|
||||
if (response.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
_logger.WriteError(response.Content.ReadAsStringAsync().Result);
|
||||
_logger.LogError(response.Content.ReadAsStringAsync().Result);
|
||||
throw new Exception(string.Format("Received the above response with status code : {0}", response.StatusCode));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace E2ETests
|
|||
var response = _httpClient.GetAsync("Account/Login").Result;
|
||||
ThrowIfResponseStatusNotOk(response);
|
||||
var responseContent = response.Content.ReadAsStringAsync().Result;
|
||||
_logger.WriteInformation("Signing in with Twitter account");
|
||||
_logger.LogInformation("Signing in with Twitter account");
|
||||
var formParameters = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("provider", "Twitter"),
|
||||
|
|
@ -85,14 +85,14 @@ namespace E2ETests
|
|||
//Verify cookie sent
|
||||
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
|
||||
Assert.Null(_httpClientHandler.CookieContainer.GetCookies(new Uri(_applicationBaseUrl)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.ExternalLogin"));
|
||||
_logger.WriteInformation("Successfully signed in with user '{email}'", "twitter@test.com");
|
||||
_logger.LogInformation("Successfully signed in with user '{email}'", "twitter@test.com");
|
||||
|
||||
_logger.WriteInformation("Verifying if the middleware notifications were fired");
|
||||
_logger.LogInformation("Verifying if the middleware notifications were fired");
|
||||
//Check for a non existing item
|
||||
response = _httpClient.GetAsync(string.Format("Admin/StoreManager/GetAlbumIdFromName?albumName={0}", "123")).Result;
|
||||
//This action requires admin permissions. If notifications are fired this permission is granted
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
_logger.WriteInformation("Middleware notifications were fired successfully");
|
||||
_logger.LogInformation("Middleware notifications were fired successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ namespace E2ETests
|
|||
{
|
||||
using (_logger.BeginScope("NtlmAuthenticationTest"))
|
||||
{
|
||||
_logger.WriteInformation("Variation Details : HostType = {hostType}, RuntimeFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}",
|
||||
_logger.LogInformation("Variation Details : HostType = {hostType}, RuntimeFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}",
|
||||
serverType, runtimeFlavor, architecture, applicationBaseUrl);
|
||||
|
||||
_startParameters = new StartParameters
|
||||
|
|
@ -35,7 +35,7 @@ namespace E2ETests
|
|||
var testStartTime = DateTime.Now;
|
||||
var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
|
||||
|
||||
_logger.WriteInformation("Pointing MusicStore DB to '{connString}'", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
_logger.LogInformation("Pointing MusicStore DB to '{connString}'", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
|
||||
//Override the connection strings using environment based configuration
|
||||
Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
|
|
@ -63,7 +63,7 @@ namespace E2ETests
|
|||
initializationCompleteTime = DateTime.Now;
|
||||
}, logger: _logger);
|
||||
|
||||
_logger.WriteInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds",
|
||||
_logger.LogInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds",
|
||||
(initializationCompleteTime - testStartTime).TotalSeconds);
|
||||
|
||||
VerifyHomePage(response, responseContent, true);
|
||||
|
|
@ -77,15 +77,15 @@ namespace E2ETests
|
|||
AccessStoreWithPermissions();
|
||||
|
||||
var testCompletionTime = DateTime.Now;
|
||||
_logger.WriteInformation("[Time]: All tests completed in '{t}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds);
|
||||
_logger.WriteInformation("[Time]: Total time taken for this test variation '{t}' seconds", (testCompletionTime - testStartTime).TotalSeconds);
|
||||
_logger.LogInformation("[Time]: All tests completed in '{t}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds);
|
||||
_logger.LogInformation("[Time]: Total time taken for this test variation '{t}' seconds", (testCompletionTime - testStartTime).TotalSeconds);
|
||||
testSuccessful = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!testSuccessful)
|
||||
{
|
||||
_logger.WriteError("Some tests failed. Proceeding with cleanup.");
|
||||
_logger.LogError("Some tests failed. Proceeding with cleanup.");
|
||||
}
|
||||
|
||||
DeploymentUtility.CleanUpApplication(_startParameters, hostProcess, musicStoreDbName, _logger);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace E2ETests
|
|||
{
|
||||
using (_logger.BeginScope("OpenIdConnectTestSuite"))
|
||||
{
|
||||
_logger.WriteInformation("Variation Details : HostType = {hostType}, DonetFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}",
|
||||
_logger.LogInformation("Variation Details : HostType = {hostType}, DonetFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}",
|
||||
serverType, donetFlavor, architecture, applicationBaseUrl);
|
||||
|
||||
_startParameters = new StartParameters
|
||||
|
|
@ -44,7 +44,7 @@ namespace E2ETests
|
|||
var testStartTime = DateTime.Now;
|
||||
var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
|
||||
|
||||
_logger.WriteInformation("Pointing MusicStore DB to '{connString}'", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
_logger.LogInformation("Pointing MusicStore DB to '{connString}'", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
|
||||
//Override the connection strings using environment based configuration
|
||||
Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
|
|
@ -78,7 +78,7 @@ namespace E2ETests
|
|||
initializationCompleteTime = DateTime.Now;
|
||||
}, logger: _logger);
|
||||
|
||||
_logger.WriteInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds",
|
||||
_logger.LogInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds",
|
||||
(initializationCompleteTime - testStartTime).TotalSeconds);
|
||||
|
||||
VerifyHomePage(response, responseContent);
|
||||
|
|
@ -87,15 +87,15 @@ namespace E2ETests
|
|||
LoginWithOpenIdConnect();
|
||||
|
||||
var testCompletionTime = DateTime.Now;
|
||||
_logger.WriteInformation("[Time]: All tests completed in '{t}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds);
|
||||
_logger.WriteInformation("[Time]: Total time taken for this test variation '{t}' seconds", (testCompletionTime - testStartTime).TotalSeconds);
|
||||
_logger.LogInformation("[Time]: All tests completed in '{t}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds);
|
||||
_logger.LogInformation("[Time]: Total time taken for this test variation '{t}' seconds", (testCompletionTime - testStartTime).TotalSeconds);
|
||||
testSuccessful = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!testSuccessful)
|
||||
{
|
||||
_logger.WriteError("Some tests failed. Proceeding with cleanup.");
|
||||
_logger.LogError("Some tests failed. Proceeding with cleanup.");
|
||||
}
|
||||
|
||||
DeploymentUtility.CleanUpApplication(_startParameters, hostProcess, musicStoreDbName, _logger);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace E2ETests
|
|||
{
|
||||
using (_logger.BeginScope("Publish_And_Run_Tests"))
|
||||
{
|
||||
_logger.WriteInformation("Variation Details : HostType = {hostType}, RuntimeFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}",
|
||||
_logger.LogInformation("Variation Details : HostType = {hostType}, RuntimeFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}",
|
||||
serverType, runtimeFlavor, architecture, applicationBaseUrl);
|
||||
|
||||
_startParameters = new StartParameters
|
||||
|
|
@ -54,7 +54,7 @@ namespace E2ETests
|
|||
var testStartTime = DateTime.Now;
|
||||
var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
|
||||
|
||||
_logger.WriteInformation("Pointing MusicStore DB to '{connString}'", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
_logger.LogInformation("Pointing MusicStore DB to '{connString}'", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
|
||||
//Override the connection strings using environment based configuration
|
||||
Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
|
|
@ -83,7 +83,7 @@ namespace E2ETests
|
|||
initializationCompleteTime = DateTime.Now;
|
||||
}, logger: _logger);
|
||||
|
||||
_logger.WriteInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds",
|
||||
_logger.LogInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds",
|
||||
(initializationCompleteTime - testStartTime).TotalSeconds);
|
||||
|
||||
VerifyHomePage(response, responseContent, true);
|
||||
|
|
@ -100,15 +100,15 @@ namespace E2ETests
|
|||
}
|
||||
|
||||
var testCompletionTime = DateTime.Now;
|
||||
_logger.WriteInformation("[Time]: All tests completed in '{t}' seconds.", (testCompletionTime - initializationCompleteTime).TotalSeconds);
|
||||
_logger.WriteInformation("[Time]: Total time taken for this test variation '{t}' seconds.", (testCompletionTime - testStartTime).TotalSeconds);
|
||||
_logger.LogInformation("[Time]: All tests completed in '{t}' seconds.", (testCompletionTime - initializationCompleteTime).TotalSeconds);
|
||||
_logger.LogInformation("[Time]: Total time taken for this test variation '{t}' seconds.", (testCompletionTime - testStartTime).TotalSeconds);
|
||||
testSuccessful = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!testSuccessful)
|
||||
{
|
||||
_logger.WriteError("Some tests failed. Proceeding with cleanup.");
|
||||
_logger.LogError("Some tests failed. Proceeding with cleanup.");
|
||||
}
|
||||
|
||||
DeploymentUtility.CleanUpApplication(_startParameters, hostProcess, musicStoreDbName, _logger);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace E2ETests
|
|||
{
|
||||
var loggerFactory = new LoggerFactory();
|
||||
loggerFactory.AddConsole();
|
||||
_logger = loggerFactory.Create<SmokeTests>();
|
||||
_logger = loggerFactory.CreateLogger<SmokeTests>();
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
|
|
@ -94,7 +94,7 @@ namespace E2ETests
|
|||
{
|
||||
using (_logger.BeginScope("SmokeTestSuite"))
|
||||
{
|
||||
_logger.WriteInformation("Variation Details : HostType = {hostType}, DonetFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}",
|
||||
_logger.LogInformation("Variation Details : HostType = {hostType}, DonetFlavor = {flavor}, Architecture = {arch}, applicationBaseUrl = {appBase}",
|
||||
serverType, donetFlavor, architecture, applicationBaseUrl);
|
||||
|
||||
_startParameters = new StartParameters
|
||||
|
|
@ -108,7 +108,7 @@ namespace E2ETests
|
|||
var testStartTime = DateTime.Now;
|
||||
var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty);
|
||||
|
||||
_logger.WriteInformation("Pointing MusicStore DB to '{connString}'", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
_logger.LogInformation("Pointing MusicStore DB to '{connString}'", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
|
||||
//Override the connection strings using environment based configuration
|
||||
Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(CONNECTION_STRING_FORMAT, musicStoreDbName));
|
||||
|
|
@ -142,7 +142,7 @@ namespace E2ETests
|
|||
initializationCompleteTime = DateTime.Now;
|
||||
}, logger: _logger);
|
||||
|
||||
_logger.WriteInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds",
|
||||
_logger.LogInformation("[Time]: Approximate time taken for application initialization : '{t}' seconds",
|
||||
(initializationCompleteTime - testStartTime).TotalSeconds);
|
||||
|
||||
VerifyHomePage(response, responseContent);
|
||||
|
|
@ -229,15 +229,15 @@ namespace E2ETests
|
|||
LoginWithMicrosoftAccount();
|
||||
|
||||
var testCompletionTime = DateTime.Now;
|
||||
_logger.WriteInformation("[Time]: All tests completed in '{t}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds);
|
||||
_logger.WriteInformation("[Time]: Total time taken for this test variation '{t}' seconds", (testCompletionTime - testStartTime).TotalSeconds);
|
||||
_logger.LogInformation("[Time]: All tests completed in '{t}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds);
|
||||
_logger.LogInformation("[Time]: Total time taken for this test variation '{t}' seconds", (testCompletionTime - testStartTime).TotalSeconds);
|
||||
testSuccessful = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!testSuccessful)
|
||||
{
|
||||
_logger.WriteError("Some tests failed. Proceeding with cleanup.");
|
||||
_logger.LogError("Some tests failed. Proceeding with cleanup.");
|
||||
}
|
||||
|
||||
DeploymentUtility.CleanUpApplication(_startParameters, hostProcess, musicStoreDbName, _logger);
|
||||
|
|
|
|||
Loading…
Reference in New Issue