public async Task ContentImport_Execute_EndToEnd() { var name1 = GetRandomSchemaName; await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1)); await SchemaClient.PublishSchema("aut", name1); var expected1 = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[0]; var expected2 = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[1]; await ContentStories.ImportContent(ContentImportSystemUnderTest, "aut", name1, AssetLoader.AsPath(AssetLoader.Schema1DataImportName), publish : true); var actuals = await ContentClient.QueryContent("aut", name1, new QueryRequest() { Skip = 0, Top = 100 }); var actualsTotal = actuals.Total; actualsTotal.Should().Be(2); var actual1 = actuals.Items[0]; var actual2 = actuals.Items[1]; // todo : verify await SchemaClient.DeleteSchema("aut", name1); await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5)); }
public async Task ContentPost_Execute_EndToEnd() { var name1 = GetRandomSchemaName; await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1)); await SchemaClient.PublishSchema("aut", name1); var expectedFirst = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[0]; var expectedSecond = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[1]; // act await ContentStories.PostContent(ContentPostSystemUnderTest, "aut", name1, AssetLoader.AsPath(AssetLoader.Schema1Data1PostName), publish : true); await ContentStories.PostContent(ContentPostSystemUnderTest, "aut", name1, AssetLoader.AsPath(AssetLoader.Schema1Data2PostName), publish : true); var content = await ContentClient.QueryContent("aut", name1, new QueryRequest() { Skip = 0, Top = 100 }); int contentTotal = Convert.ToInt32(content.Total); contentTotal.Should().Be(2); var actualFirst = content.Items[0]; var actualSecond = content.Items[1]; // todo : verify export content await SchemaClient.DeleteSchema("aut", name1); await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5)); }
public async Task Restore_EndToEnd() { // Query only 'sees' published records so that is a quick way to determine publish state // - insert some records // - publish them // - archive them // - assert there are none (because we archived them) var schemaName = GetRandomName; await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5)); var createschema = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName)); var publishedschema = await SchemaClient.PublishSchema("aut", schemaName); var create1response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName)); var create2response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName)); await Task.Delay(TimeSpan.FromSeconds(1)); await ContentClient.PublishContent("aut", schemaName, create1response.Id); await ContentClient.PublishContent("aut", schemaName, create2response.Id); await Task.Delay(TimeSpan.FromSeconds(1)); await ContentClient.ArchiveContent("aut", schemaName, create1response.Id); await ContentClient.ArchiveContent("aut", schemaName, create2response.Id); // act // note : eventual consistency and all that sometimes we don't get away with validating right away. await Task.Delay(TimeSpan.FromSeconds(1)); await ContentClient.RestoreContent("aut", schemaName, create1response.Id); await ContentClient.RestoreContent("aut", schemaName, create2response.Id); await Task.Delay(TimeSpan.FromSeconds(1)); //var content = await ContentClient.Query<dynamic>("aut", schemaName, new QueryRequest() //{ // Skip = 0, // Top = 100 //}); var content = await ContentClient.QueryContent("aut", schemaName, top : 100, skip : 0); // ma content.Total.Should().Be(2); // clean up await SchemaClient.DeleteSchema("aut", schemaName); }
public async Task Query_EndToEnd() { var schemaName = GetRandomName; await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5)); var createschema = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName)); var publishedschema = await SchemaClient.PublishSchema("aut", schemaName); dynamic create1response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName)); dynamic create2response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName)); string create1id = Convert.ToString(create1response.id); string create2id = Convert.ToString(create2response.id); await ContentClient.PublishContent("aut", schemaName, create1id); await ContentClient.PublishContent("aut", schemaName, create2id); // act // note : eventual consistency and all that sometimes we don't get away with validating right away. await Task.Delay(TimeSpan.FromSeconds(1)); //var content = await ContentClient.Query<dynamic>("aut", schemaName, new QueryRequest() //{ // Skip = 0, // Top = 100 //}); var content = await ContentClient.QueryContent("aut", schemaName, top : 100, skip : 0); int contenttotal = Convert.ToInt32(content.total); contenttotal.Should().Be(2); var actualFirst = content.items[0]; var actualSecond = content.items[1]; // todo : verify export content await SchemaClient.DeleteSchema("aut", schemaName); }