Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
tian-lt committed Nov 25, 2024
1 parent 7e4938e commit a4b09e0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/CalculatorUITests/CurrencyConverterFunctionalTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Diagnostics;
using CalculatorUITestFramework;

using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand Down Expand Up @@ -43,6 +45,7 @@ public static void ClassCleanup()
[TestInitialize]
public void TestInit()
{
VerifyConnection();
CalculatorApp.EnsureCalculatorHasFocus();
page.EnsureCalculatorIsCurrencyMode();
page.EnsureCalculatorResultTextIsZero();
Expand All @@ -55,6 +58,25 @@ public void TestCleanup()
page.ClearAll();
}

private static void VerifyConnection()
{
var process = new Process();
var startInfo = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Hidden,
FileName = "cmd.exe",
Arguments = @"/C curl ""http://localhost/calctesting/file/?id=currency+converter+data&localCurrency=""",
RedirectStandardOutput = true, // Redirect the standard output
UseShellExecute = false,
CreateNoWindow = true
};
process.StartInfo = startInfo;
process.Start();
var debug = process.StandardOutput.ReadToEnd();
process.WaitForExit();
Console.WriteLine($"----------- exitcode: {process.ExitCode}, curl result: {debug}");
}

private string NormalizeCurrencyText(string realValue, int fractionDigits)
{
if (!realValue.Contains('.')) return realValue;
Expand Down

0 comments on commit a4b09e0

Please sign in to comment.