コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public async Task ContentDelete_Execute_EndToEnd()
        {
            var name1 = GetRandomSchemaName;
            await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1));

            await SchemaClient.PublishSchema("aut", name1);

            dynamic create1response = await ContentClient.CreateContent("aut", name1, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            dynamic create2response = await ContentClient.CreateContent("aut", name1, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            string create1id = Convert.ToString(create1response.id);
            string create2id = Convert.ToString(create2response.id);
            await ContentClient.PublishContent("aut", name1, create1id);

            await ContentClient.PublishContent("aut", name1, create2id);

            // act

            await ContentStories.DeleteContent(ContentDeleteSystemUnderTest, "aut", name1, create1id);

            // todo : verify export content

            await ContentClient.AssertContentMustNotExists("aut", name1, create1id, delay : TimeSpan.FromSeconds(0.5));

            await ContentClient.AssertContentMustExists("aut", name1, create2id, delay : TimeSpan.FromSeconds(0.5));

            // clean up

            await SchemaClient.DeleteSchema("aut", name1);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
コード例 #4
0
        public async Task ContentExport_Execute_EndToEnd()
        {
            var name1  = GetRandomSchemaName;
            var export = Path.Combine(AssetLoader.ExportPath, $"{nameof(ContentHandlersIntegrationTest)} {nameof(ContentExport_Execute_EndToEnd)}-out.json");

            await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1));

            await SchemaClient.PublishSchema("aut", name1);

            dynamic create1response = await ContentClient.CreateContent("aut", name1, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            dynamic create2response = await ContentClient.CreateContent("aut", name1, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            string create1id = Convert.ToString(create1response.id);
            string create2id = Convert.ToString(create2response.id);
            await ContentClient.PublishContent("aut", name1, create1id);

            await ContentClient.PublishContent("aut", name1, create2id);

            var expected1 = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[0];
            var expected2 = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[1];

            // act

            await ContentStories.ExportContent(ContentExportSystemUnderTest, "aut", name1, export, top : "10", skip : "0");

            var exportExists = File.Exists(export);

            exportExists.Should().BeTrue($"{nameof(SchemaExportRequest)} failed to export file");

            // todo : verify export content

            await SchemaClient.DeleteSchema("aut", name1);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }