EnsureEntityAsync() public static method

public static EnsureEntityAsync ( int entityId, string text = null ) : System.Threading.Tasks.Task
entityId int
text string
return System.Threading.Tasks.Task
        public async Task ApiHubTableEntityIn()
        {
            TestHelpers.ClearFunctionLogs("ApiHubTableEntityIn");

            // Ensure the test entity exists.
            await ApiHubTestHelper.EnsureEntityAsync(ApiHubTestHelper.EntityId4);

            // Test table entity out binding.
            JObject input = new JObject
            {
                { "table", "SampleTable" },
                { "id", ApiHubTestHelper.EntityId4 }
            };
            await Fixture.Host.CallAsync("ApiHubTableEntityIn",
                                         new Dictionary <string, object>()
            {
                { "input", input.ToString() }
            });

            var logs = await TestHelpers.GetFunctionLogsAsync("ApiHubTableEntityIn");

            string expectedLog = string.Format("TestResult: {0}", ApiHubTestHelper.EntityId4);

            Assert.True(logs.Any(p => p.Contains(expectedLog)));
        }
示例#2
0
        public async Task ApiHubTableClientBindingTest()
        {
            var textArgValue = ApiHubTestHelper.NewRandomString();

            // Ensure the test entity exists.
            await ApiHubTestHelper.EnsureEntityAsync(ApiHubTestHelper.EntityId1);

            // Test table client binding.
            await Fixture.Host.CallAsync("ApiHubTableClient",
                                         new Dictionary <string, object>()
            {
                { ApiHubTestHelper.TextArg, textArgValue }
            });

            await ApiHubTestHelper.AssertTextUpdatedAsync(
                textArgValue, ApiHubTestHelper.EntityId1);
        }
示例#3
0
        public async Task ApiHubTableEntityBindingTest()
        {
            var textArgValue = ApiHubTestHelper.NewRandomString();

            // Ensure the test entity exists.
            await ApiHubTestHelper.EnsureEntityAsync(ApiHubTestHelper.EntityId3);

            // Test table entity binding.
            TestInput input = new TestInput
            {
                Id    = ApiHubTestHelper.EntityId3,
                Value = textArgValue
            };
            await Fixture.Host.CallAsync("ApiHubTableEntity",
                                         new Dictionary <string, object>()
            {
                { "input", JsonConvert.SerializeObject(input) }
            });

            await ApiHubTestHelper.AssertTextUpdatedAsync(
                textArgValue, ApiHubTestHelper.EntityId3);
        }