private static Workspace PostWorkspaceInner(Workspace input) { var body = JsonSerializer.Serialize(input); var request = JsonApiRequest.Create("adamo", RequestAction.Save, body); var logger = LoggerFactory.Create(config => config.AddDebug()).CreateLogger("AzureHttpFunction"); var repo = new Repository <Workspace>(LocalDb.GetConnectionString(DbName), logger); var function = new SampleFunction <Workspace>(request, logger, repo); return((function.ExecuteAsync().Result as OkObjectResult).Value as Workspace); }
public void DeleteWorkspace() { var result = CreateWorkspaceInner(WsName); var id = result.Id; var request = JsonApiRequest.Create("adamo", RequestAction.Delete, null, query: new Dictionary <string, object>() { ["id"] = id }); var logger = LoggerFactory.Create(config => config.AddDebug()).CreateLogger("AzureHttpFunction"); var repo = new Repository <Workspace>(LocalDb.GetConnectionString(DbName), logger); var function = new SampleFunction <Workspace>(request, logger, repo); function.ExecuteAsync().Wait(); using var cn = LocalDb.GetConnection(DbName); Assert.IsTrue(!cn.RowExistsAsync("[dbo].[Workspace] WHERE [Name]=@name", new { name = WsName }).Result); }