Integration tests using sqlite memory two api calls

0

I am having trouble making an insert call (and creating the database) after the query occurs that the database is in memory the problem is that the acada call the database dies. It would be interesting to be able to do the database creation in my test and manipulate it.

// Act
var model = new CreateOrUpdateTagsModel
{
    UserId = 1,
    CatalogItemType = "Movie",
    Owner = 1,
    PinRequired = false,
    ProductId = 1,
    TagType = "Stars",
    TagValue = "5"
};

var jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
var json = JsonConvert.SerializeObject(model, jsonSerializerSettings);

var response2 = await _client.PutAsync("/v1/tags", new StringContent(json, Encoding.UTF8, "application/json"));
response2.EnsureSuccessStatusCode();

var responseString2 = await response2.Content.ReadAsStringAsync();

var response = await _client.GetAsync("/v1/tags?userId=1");
response.EnsureSuccessStatusCode();
    
asked by anonymous 19.05.2018 / 23:11

1 answer

0

I could solve by changing my StartupTest.cs to IDbConnection using AddSingleton and in my test using _queryExecutor = _server.Host.Services.GetService(typeof(IQueryExecutor)) as IQueryExecutor; being _server instance of TestServer .

    
22.05.2018 / 22:26