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); }
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>(); }
public IActionResult Post([FromBody] ContractPhone newPhone) { try { telecomProviderHandler.ActivatePhone(newPhone); return(StatusCode(201)); } catch (AlreadyRegisteredException) { return(StatusCode(500)); } }
public void ActivatePhone(ContractPhone newPhone) { telecomProviderRepository.Save(newPhone.CustomerId, newPhone.PhoneNumber); }