Пример #1
0
 public async Task <ActionResult <ContactV1> > PostAsync([FromBody] CreateContactRequestV1 contact)
 {
     try
     {
         return(await _mediator.Send(contact));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Пример #2
0
        private void CreationOfTestCasesAndMock()
        {
            _mediator          = A.Fake <IMediator>();
            _contactController = new ContactController(_mediator);

            _contactCreateReturned = new ContactV1
            {
                Firstname         = "Arthur",
                Lastname          = "Picaud",
                Fullname          = "Arthur Picaud",
                Address           = "18 rue Colbert Lille",
                Email             = "*****@*****.**",
                MobilePhoneNumber = "+33 7 89 73 78 62"
            };
            _createContactValid = new CreateContactRequestV1
            {
                Firstname         = "Arthur",
                Lastname          = "Picaud",
                Address           = "18 rue Colbert Lille",
                Email             = "*****@*****.**",
                MobilePhoneNumber = "+33 7 89 73 78 62"
            };
            _createContactWithInvalidMail = new CreateContactRequestV1
            {
                Firstname         = "Arthur",
                Lastname          = "Picaud",
                Address           = "18 rue Colbert Lille",
                Email             = "badRegex",
                MobilePhoneNumber = "+33 7 89 73 78 62"
            };
            _updateContact = new UpdateContactRequestV1
            {
                Id                = 7,
                Firstname         = "James",
                Lastname          = "Bond",
                Address           = "MI6 London",
                Email             = "*****@*****.**",
                MobilePhoneNumber = "00 70 07 00 70"
            };
            _contactUpdateReturned = new ContactV1
            {
                Firstname         = "James",
                Lastname          = "Bond",
                Fullname          = "James Bond",
                Address           = "MI6 London",
                Email             = "*****@*****.**",
                MobilePhoneNumber = "00 70 07 00 70"
            };
        }