public async Task <ActionResult <ResultObject <PDVEntity> > > New([FromBody] RequestObject <PDVEntity> request) { var app = AppPDV.Create(); ResultObject <PDVEntity> ret = null; using (AsyncScopedLifestyle.BeginScope(app.Container)) { ret = await app.GetService <ICreatePDVService>().Run(request); } return(ret); }
public async Task QueryByIdTest() { var app = AppPDV.Create(); using (AsyncScopedLifestyle.BeginScope(app.Container)) { var request = new RequestObject <int>(); request.Data = 31; var ret = await app.GetService <IQueryByIdPDVService>().Run(request); Assert.NotNull(ret.Data); } }
public async Task QueryNearstPDVTest() { var app = AppPDV.Create(); using (AsyncScopedLifestyle.BeginScope(app.Container)) { var request = new RequestObject <double[]>(); request.Data = new double[] { -46.57421, -21.785741 }; var ret = await app.GetService <IQueryNearstPDVService>().Run(request); Assert.NotNull(ret.Data); } }
public async Task CreatePDVSameDocument() { var app = AppPDV.Create(); using (AsyncScopedLifestyle.BeginScope(app.Container)) { var request = new RequestObject <PDVEntity>(); var json = @"{ ""id"": 0, ""tradingName"": ""Nova loja"", ""ownerName"": ""Anderson mendes"", ""document"": ""22745914/0001-14"", ""coverageArea"": { ""type"": ""MultiPolygon"", ""coordinates"": [ [ [ [ -46.80874, -23.58613 ], [ -46.83603, -23.62247 ], [ -46.85234, -23.65691 ], [ -46.76994, -23.69558 ], [ -46.7502, -23.69641 ], [ -46.73046, -23.68906 ], [ -46.73355, -23.67917 ]]] ] }, ""address"": { ""type"": ""Point"", ""coordinates"": [-46.57421, -21.785741] }, }"; request.Data = JsonConvert.DeserializeObject <PDVEntity>(json); var ret = await app.GetService <ICreatePDVService>().Run(request); Assert.IsNull(ret.Data); Assert.Equals(ret.ErrorMessage, "Document number already exists."); } }