Exemplo n.º 1
0
 public void Can_call_RequiredPermission_service_with_BasicAuth()
 {
     try
     {
         var client  = GetClientWithUserPassword();
         var request = new RequiresPermission {
             Name = "test"
         };
         var response = client.Send <RequiresPermissionResponse>(request);
         Assert.That(response.Result, Is.EqualTo(request.Name));
     }
     catch (WebServiceException webEx)
     {
         Assert.Fail(webEx.Message);
     }
 }
Exemplo n.º 2
0
 public void RequiredPermission_service_returns_unauthorized_if_no_basic_auth_header_exists()
 {
     try
     {
         var client  = GetClient();
         var request = new RequiresPermission {
             Name = "test"
         };
         var response = client.Send <RequiresPermissionResponse>(request);
         Assert.Fail();
     }
     catch (WebServiceException webEx)
     {
         Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Unauthorized));
         Console.WriteLine(webEx.ResponseDto.Dump());
     }
 }
Exemplo n.º 3
0
        public void RequiredPermission_service_returns_forbidden_if_basic_auth_header_exists()
        {
            try
            {
                var client = GetClient();
                ((ServiceClientBase)client).UserName = EmailBasedUsername;
                ((ServiceClientBase)client).Password = PasswordForEmailBasedAccount;

                var request = new RequiresPermission {
                    Name = "test"
                };
                var response = client.Send <RequiresPermissionResponse>(request);
                Assert.Fail();
            }
            catch (WebServiceException webEx)
            {
                Assert.That(webEx.StatusCode, Is.EqualTo((int)HttpStatusCode.Forbidden));
                Console.WriteLine(webEx.ResponseDto.Dump());
            }
        }
Exemplo n.º 4
0
 public RequiresPermissionResponse Any(RequiresPermission request)
 {
     return(new RequiresPermissionResponse {
         Result = request.Name
     });
 }