|
|
@ -35,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
public async Task GetAll_Test() |
|
|
public async Task GetAll_Test() |
|
|
{ |
|
|
{ |
|
|
//Ideally should be [GET] /api/app/person
|
|
|
//Ideally should be [GET] /api/app/person
|
|
|
var result = await GetResponseAsObjectAsync<ListResultDto<PersonDto>>("/api/services/app/person/GetAll"); |
|
|
var result = await GetResponseAsObjectAsync<ListResultDto<PersonDto>>("/api/app/person/GetAll"); |
|
|
result.Items.Count.ShouldBeGreaterThan(0); |
|
|
result.Items.Count.ShouldBeGreaterThan(0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -45,7 +45,7 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
var firstPerson = _personRepository.GetList().First(); |
|
|
var firstPerson = _personRepository.GetList().First(); |
|
|
|
|
|
|
|
|
//Ideally should be [GET] /api/app/person/{id}
|
|
|
//Ideally should be [GET] /api/app/person/{id}
|
|
|
var result = await GetResponseAsObjectAsync<PersonDto>("/api/services/app/person/Get?id=" + firstPerson.Id); |
|
|
var result = await GetResponseAsObjectAsync<PersonDto>("/api/app/person/Get?id=" + firstPerson.Id); |
|
|
result.Name.ShouldBe(firstPerson.Name); |
|
|
result.Name.ShouldBe(firstPerson.Name); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -55,7 +55,7 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
var firstPerson = _personRepository.GetList().First(); |
|
|
var firstPerson = _personRepository.GetList().First(); |
|
|
|
|
|
|
|
|
//Ideally should be [DELETE] /api/app/person/{id}
|
|
|
//Ideally should be [DELETE] /api/app/person/{id}
|
|
|
await Client.DeleteAsync("/api/services/app/person/Delete?id=" + firstPerson.Id); |
|
|
await Client.DeleteAsync("/api/app/person/Delete?id=" + firstPerson.Id); |
|
|
|
|
|
|
|
|
(await _personRepository.FindAsync(firstPerson.Id)).ShouldBeNull(); |
|
|
(await _personRepository.FindAsync(firstPerson.Id)).ShouldBeNull(); |
|
|
} |
|
|
} |
|
|
@ -69,7 +69,7 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
|
|
|
|
|
|
//Ideally should be [POST] /api/app/person
|
|
|
//Ideally should be [POST] /api/app/person
|
|
|
var response = await Client.PostAsync( |
|
|
var response = await Client.PostAsync( |
|
|
"/api/services/app/person/Create", |
|
|
"/api/app/person/Create", |
|
|
new StringContent(postData, Encoding.UTF8, "application/json") |
|
|
new StringContent(postData, Encoding.UTF8, "application/json") |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
@ -102,7 +102,7 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
|
|
|
|
|
|
//Ideally should be [PUT] /api/app/person/{id}
|
|
|
//Ideally should be [PUT] /api/app/person/{id}
|
|
|
var response = await Client.PutAsync( |
|
|
var response = await Client.PutAsync( |
|
|
"/api/services/app/person/Update?id=" + updateDto.Id, |
|
|
"/api/app/person/Update?id=" + updateDto.Id, |
|
|
new StringContent(putData, Encoding.UTF8, "application/json") |
|
|
new StringContent(putData, Encoding.UTF8, "application/json") |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
@ -136,7 +136,7 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
|
|
|
|
|
|
//Ideally should be [POST] /api/people/{id}/phones
|
|
|
//Ideally should be [POST] /api/people/{id}/phones
|
|
|
var response = await Client.PostAsync( |
|
|
var response = await Client.PostAsync( |
|
|
"/api/services/app/person/AddPhone?id=" + personToAddNewPhone.Id, |
|
|
"/api/app/person/AddPhone?id=" + personToAddNewPhone.Id, |
|
|
new StringContent(postData, Encoding.UTF8, "application/json") |
|
|
new StringContent(postData, Encoding.UTF8, "application/json") |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
@ -160,7 +160,7 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
var douglas = _personRepository.GetList().First(p => p.Name == "Douglas"); |
|
|
var douglas = _personRepository.GetList().First(p => p.Name == "Douglas"); |
|
|
|
|
|
|
|
|
//Ideally should be [GET] /api/person/{id}/phones?type=office
|
|
|
//Ideally should be [GET] /api/person/{id}/phones?type=office
|
|
|
var result = await GetResponseAsObjectAsync<ListResultDto<PhoneDto>>("/api/services/app/person/GetPhones?id=" + douglas.Id); |
|
|
var result = await GetResponseAsObjectAsync<ListResultDto<PhoneDto>>("/api/app/person/GetPhones?id=" + douglas.Id); |
|
|
result.Items.Count.ShouldBe(douglas.Phones.Count); |
|
|
result.Items.Count.ShouldBe(douglas.Phones.Count); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -171,7 +171,7 @@ namespace Volo.Abp.AspNetCore.Mvc |
|
|
var firstPhone = douglas.Phones.First(); |
|
|
var firstPhone = douglas.Phones.First(); |
|
|
|
|
|
|
|
|
//Ideally should be [DELETE] /api/app/person/{id}
|
|
|
//Ideally should be [DELETE] /api/app/person/{id}
|
|
|
await Client.DeleteAsync("/api/services/app/person/DeletePhone?id=" + douglas.Id + "&phoneId=" + firstPhone.Id); |
|
|
await Client.DeleteAsync("/api/app/person/DeletePhone?id=" + douglas.Id + "&phoneId=" + firstPhone.Id); |
|
|
|
|
|
|
|
|
douglas = _personRepository.GetList().First(p => p.Name == "Douglas"); |
|
|
douglas = _personRepository.GetList().First(p => p.Name == "Douglas"); |
|
|
douglas.Phones.Any(p => p.Id == firstPhone.Id).ShouldBeFalse(); |
|
|
douglas.Phones.Any(p => p.Id == firstPhone.Id).ShouldBeFalse(); |
|
|
|