public void ShouldThrowExceptionIfThereIsExceptionDuringRegisterClaimer()
        {
            registerClaimer = new ThrowExceptionWhileRegisterClaimerData();
            controller      = new RegisterClaimerController(registerClaimer);
            var registerClaimerRequest = new RegisterClaimerRequest();

            Assert.That(delegate {
                var result = controller.Post(registerClaimerRequest);
            }, Throws.TypeOf <HttpResponseException>());
        }
Esempio n. 2
0
 public Guid Execute(RegisterClaimerRequest request)
 {
     try
     {
         var claimerDataValidator = new ClaimerDataValidator();
         claimerDataValidator.Validate(request.ClaimerData);
         var id = Save(request.ClaimerData);
         return(id);
     }
     catch (Exception e)
     {
         throw new RegisterClaimerException("An error has occured during registring claimers data", e);
     }
 }
Esempio n. 3
0
        public HttpResponseMessage Post(RegisterClaimerRequest registerClaimerRequest)
        {
            HttpResponseMessage response;
            Guid claimerId;

            try
            {
                claimerId = _registerClaimer.Execute(registerClaimerRequest);
            }
            catch (RegisterClaimerException e)
            {
                response = BadRequest(e);
                throw new HttpResponseException(response);
            }

            response = OkObject <Guid>(claimerId);

            return(response);
        }
        public void ShouldReturnOkForProperRequest()
        {
            registerClaimer = new FakeRegisterClaimerData();
            controller      = new RegisterClaimerController(registerClaimer);

            var registerClaimerRequest = new RegisterClaimerRequest()
            {
                ClaimerData = new Person {
                    LastName       = "Forest",
                    FirstName      = "Gump",
                    MiddleName     = "J.",
                    DateOfBirth    = new DateTime(1979, 4, 10),
                    PassportSeries = "2323",
                    PassportNumber = "234534",
                    PassportDate   = new DateTime(2010, 10, 2),
                    Snils          = "12334243232"
                }
            };
            var result = controller.Post(registerClaimerRequest);

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.InstanceOf(typeof(HttpResponseMessage)));
            Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
Esempio n. 5
0
 public Guid Execute(RegisterClaimerRequest request)
 {
     return(Guid.Empty);
 }
 public Guid Execute(RegisterClaimerRequest request)
 {
     throw new RegisterClaimerException();
 }