Exemple #1
0
        public async Task Test_Simplest_Code()
        {
            var result = await Simplest_Daytime_Sample_Rfc_867.RunAsync();

            if (!Infrastructure.IfTrueError(!result.Succeeded, "!result.Succeeded"))
            {
                Infrastructure.IfTrueError(result.Value == null, "result.Value is null");
                Infrastructure.IfTrueError(result.Value != null && (result.Value.Length < 10 || result.Value.Length > 60), $"result.Value is weird size ({result.Value})");
            }
            Infrastructure.IfTrueError(result.TimeInSeconds < 0, $"result.TimeInSeconds too small ({result.TimeInSeconds})");
            Infrastructure.IfTrueError(result.TimeInSeconds > 1.50, $"result.TimeInSeconds too large ({result.TimeInSeconds})");
        }
        private async Task <int> DoFullTest()
        {
            int nerror = 0;

            Infrastructure.LogError   += LogTestError;
            Infrastructure.LogMessage += LogTestMessage;


            uiSystemTestResults.Text += "Simplest_Daytime_Sample_Rfc_867.RunAsync: ";
            var result867simple = await Simplest_Daytime_Sample_Rfc_867.RunAsync();

            if (!result867simple.Succeeded)
            {
                nerror++;
            }
            uiSystemTestResults.Text += $" {nerror}\n";


            uiSystemTestResults.Text += "Simplest_Time_Sample_Rfc_868.RunAsync: ";
            var result868simple = await Simplest_Time_Sample_Rfc_868.RunAsync();

            if (!result868simple.Succeeded)
            {
                nerror++;
            }
            uiSystemTestResults.Text += $" {nerror}\n";


            uiSystemTestResults.Text += "TimeServer_Rfc_868.TimeConversion.TestCalendar:";
            nerror += TimeServer_Rfc_868.TimeConversion.TestCalendar();
            uiSystemTestResults.Text += $" {nerror}\n";

            //
            // Tests for each protocol.
            //
            uiSystemTestResults.Text += "CharGenTest_Rfc_864.Test: ";
            Infrastructure.NError     = 0;
            await CharGenTest_Rfc_864.Test();

            nerror += Infrastructure.NError;
            uiSystemTestResults.Text += $" {nerror}\n";

            uiSystemTestResults.Text += "DaytimeTest_Rfc_867.Test: ";
            Infrastructure.NError     = 0;
            await DaytimeTest_Rfc_867.Test();

            nerror += Infrastructure.NError;
            uiSystemTestResults.Text += $" {nerror}\n";

            uiSystemTestResults.Text += "EchoTest_Rfc_862.Test: ";
            Infrastructure.NError     = 0;
            await EchoTest_Rfc_862.Test();

            nerror += Infrastructure.NError;
            uiSystemTestResults.Text += $" {nerror}\n";

            uiSystemTestResults.Text += "TimeTest_Rfc_868.Test: ";
            Infrastructure.NError     = 0;
            await TimeTest_Rfc_868.Test();

            nerror += Infrastructure.NError;
            uiSystemTestResults.Text += $" {nerror}\n";

            uiSystemTestResults.Text  += $"\n\n\nTotal errors: {nerror}";
            Infrastructure.LogError   -= LogTestError;
            Infrastructure.LogMessage -= LogTestMessage;

            return(nerror);
        }