コード例 #1
0
 public async void SumWithOMiauAuth_Manual_Anonymous_Fails_Async()
 {
     await Assert.ThrowsAsync <FaultException <ExceptionDetail> >(
         async() =>
         await ClientUsageScenarios.SumWithOMiauAuth_StandardClient_Anonymous_Fails_Async()
         );
 }
コード例 #2
0
        static async Task MainAsync()
        {
            Console.WriteLine("@@@@@@ Checking an ordinary WCF client @@@@@.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_StandardClient_Anonymous_Sync));
            ClientUsageScenarios.SumTwoNumbers_StandardClient_Anonymous_Sync();
            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_StandardClient_Anonymous_Async));
            await ClientUsageScenarios.SumTwoNumbers_StandardClient_Anonymous_Async();

            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_StandardClient_Anonymous_Async));
            await ClientUsageScenarios.SumTwoNumbers_StandardClient_Anonymous_Async();

            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumWithOMiauAuth_StandardClient_Anonymous_Fails_Sync));
            bool exceptionThrown = false;

            try
            {
                ClientUsageScenarios.SumWithOMiauAuth_StandardClient_Anonymous_Fails_Sync();
            }
            catch (FaultException <ExceptionDetail> ex)
            {
                exceptionThrown = true;
                Console.WriteLine("Got FaultException AS EXPECTED: {0}", ex.Message);
            }

            if (!exceptionThrown)
            {
                Console.WriteLine("FAIL - OMiau protected method can be accessed with Anonymous auth.");
                return;
            }

            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumWithOMiauAuth_StandardClient_Anonymous_Fails_Async));
            exceptionThrown = false;
            try
            {
                await ClientUsageScenarios.SumWithOMiauAuth_StandardClient_Anonymous_Fails_Async();
            }
            catch (FaultException <ExceptionDetail> ex)
            {
                exceptionThrown = true;
                Console.WriteLine("Got FaultException AS EXPECTED: {0}", ex.Message);
            }

            if (!exceptionThrown)
            {
                Console.WriteLine("FAIL - OMiau protected method can be accessed with Anonymous auth.");
                return;
            }

            Console.WriteLine("OK.\n");

            Console.WriteLine("@@@@@@ Diving into level 1 @@@@@.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_ManualClient_Anonymous_Sync));
            ClientUsageScenarios.SumTwoNumbers_ManualClient_Anonymous_Sync();
            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_ManualClient_Anonymous_Async));
            await ClientUsageScenarios.SumTwoNumbers_ManualClient_Anonymous_Async();

            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_Sync));
            ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_Sync();
            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_HandlesExpiredToken_Sync));
            ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_HandlesExpiredToken_Sync();
            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_Async));
            await ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_Async();

            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_HandlesExpiredToken_Async));
            await ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_HandlesExpiredToken_Async();

            Console.WriteLine("OK.\n");

            Console.WriteLine("@@@@@@ Diving into level 2 @@@@@.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_Slim_Sync));
            ClientUsageScenarios.SumTwoNumbers_Slim_Sync();
            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_Slim_Async));
            await ClientUsageScenarios.SumTwoNumbers_Slim_Async();

            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_SlimOMiau_Sync));
            ClientUsageScenarios.SumTwoNumbers_SlimOMiau_Sync();
            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_SlimOMiau_HandlesExpiredToken_Sync));
            ClientUsageScenarios.SumTwoNumbers_SlimOMiau_HandlesExpiredToken_Sync();
            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_SlimOMiau_Async));
            await ClientUsageScenarios.SumTwoNumbers_SlimOMiau_Async();

            Console.WriteLine("OK.\n");

            Console.WriteLine(nameof(ClientUsageScenarios.SumTwoNumbers_SlimOMiau_HandlesExpiredToken_Async));
            await ClientUsageScenarios.SumTwoNumbers_SlimOMiau_HandlesExpiredToken_Async();

            Console.WriteLine("OK.\n");
        }
コード例 #3
0
 public void SumTwoNumbers_SlimOMiau_Sync()
 {
     ClientUsageScenarios.SumTwoNumbers_SlimOMiau_Sync();
 }
コード例 #4
0
 public async Task SumTwoNumbers_Slim_Async()
 {
     await ClientUsageScenarios.SumTwoNumbers_Slim_Async();
 }
コード例 #5
0
 public async void SumTwoNumbers_ManualClient_OMiau_HandlesExpiredToken_Async()
 {
     await ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_HandlesExpiredToken_Async();
 }
コード例 #6
0
 public async void SumTwoNumbers_ManualClient_OMiau_Async()
 {
     await ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_Async();
 }
コード例 #7
0
 public void SumTwoNumbers_ManualClient_OMiau_Handles_ExpiredToken_Sync()
 {
     ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_HandlesExpiredToken_Sync();
 }
コード例 #8
0
 public void SumTwoNumbers_ManualClient_OMiau_Sync()
 {
     ClientUsageScenarios.SumTwoNumbers_ManualClient_OMiau_Sync();
 }
コード例 #9
0
 public async void SumTwoNumbers_ManualClient_Anonymous_Async()
 {
     await ClientUsageScenarios.SumTwoNumbers_ManualClient_Anonymous_Async();
 }
コード例 #10
0
 public void SumTwoNumbers_ManualClient_Anonymous_Sync()
 {
     ClientUsageScenarios.SumTwoNumbers_ManualClient_Anonymous_Sync();
 }
コード例 #11
0
 public void SumWithOMiauAuth_StandardClient_Anonymous_Fails_Sync()
 {
     Assert.Throws <FaultException <ExceptionDetail> >(
         () => ClientUsageScenarios.SumWithOMiauAuth_StandardClient_Anonymous_Fails_Sync());
 }
コード例 #12
0
 public void SumTwoNumbers_StandardClient_Anonymous_Sync()
 {
     ClientUsageScenarios.SumTwoNumbers_StandardClient_Anonymous_Sync();
 }
コード例 #13
0
 public async Task SumTwoNumbers_SlimOMiau_HandlesExpiredToken_Async()
 {
     await ClientUsageScenarios.SumTwoNumbers_SlimOMiau_HandlesExpiredToken_Async();
 }
コード例 #14
0
 public void SumTwoNumbers_SlimOMiau_HandlesExpiredToken_Sync()
 {
     ClientUsageScenarios.SumTwoNumbers_SlimOMiau_HandlesExpiredToken_Sync();
 }