Beispiel #1
0
        private static async Task TestTimeSeriesTypeWhereErrorIsExpected(TimeSeriesInsightsClient client, List <TimeSeriesType> timeSeriesTypes, string timeSeriesTypesName)
        {
            // create numeric type and expect failure due to invalid input expression
            Response <TimeSeriesOperationError[]> createTypesResult = await client
                                                                      .CreateOrReplaceTimeSeriesTypesAsync(timeSeriesTypes)
                                                                      .ConfigureAwait(false);

            // Assert that the result error array does not contain an error
            createTypesResult.Value.Should().OnlyContain((errorResult) => errorResult != null);

            // Get the type by name and expect error
            var getTypesByNamesResult = await client
                                        .GetTimeSeriesTypesByNamesAsync(new string[] { timeSeriesTypesName })
                                        .ConfigureAwait(false);

            getTypesByNamesResult.Value.Should().OnlyContain((errorResult) => errorResult.Error != null);

            // Delete the type by name and expect error
            Response <TimeSeriesOperationError[]> deleteTypesResponse = await client
                                                                        .DeleteTimeSeriesTypesByNamesAsync(new string[] { timeSeriesTypesName })
                                                                        .ConfigureAwait(false);

            // Response is null even when type does not exist.
            deleteTypesResponse.Value.Should().OnlyContain((errorResult) => errorResult == null);
        }