Пример #1
0
        private HttpResponseMessage RegisterOneCustomer(ContractPhone contractPhone)
        {
            var json          = JsonConvert.SerializeObject(contractPhone);
            var stringContent = new StringContent(json, Encoding.UTF8, MediaTypeNames.Application.Json);

            return(client.PostAsync("/api/TelecomProvider", stringContent).Result);
        }
Пример #2
0
 public TelecomProviderShould()
 {
     fixture          = new Fixture();
     server           = new TestServer(new WebHostBuilder().UseStartup <Startup>());
     client           = server.CreateClient();
     A_CONTRACT_PHONE = fixture.Create <ContractPhone>();
     A_CUSTOMER_ID    = fixture.Create <int>();
 }
Пример #3
0
 public IActionResult Post([FromBody] ContractPhone newPhone)
 {
     try
     {
         telecomProviderHandler.ActivatePhone(newPhone);
         return(StatusCode(201));
     } catch (AlreadyRegisteredException)
     {
         return(StatusCode(500));
     }
 }
Пример #4
0
 public void ActivatePhone(ContractPhone newPhone)
 {
     telecomProviderRepository.Save(newPhone.CustomerId, newPhone.PhoneNumber);
 }