Exemplo n.º 1
0
        public void NoDataValidation()
        {
            _predefinedTag = null;
            ///subscriptions/0accec26-d6de-4757-8e74-d080f38eaaab/tagNames/platformsettings.host_environment.service.platform_optedin_for_rootcerts
            var resource = Client.GetPreDefinedTag(new ResourceIdentifier($"/subscriptions/{Guid.NewGuid()}/tagNames/fakeTagName"));

            Assert.Throws <InvalidOperationException>(() => { var data = resource.Data; });
        }
        public async Task StartCreate()
        {
            var tagName    = Recording.GenerateAssetName("tagName");
            var collection = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetPredefinedTags();
            var result     = await collection.CreateOrUpdateAsync(tagName);

            _predefinedTag = result.Value;
            Assert.IsTrue(result.Value.Data.TagName.Equals(tagName));
        }
Exemplo n.º 3
0
        public async Task GetTagsOperation()
        {
            _predefinedTag = null;
            Subscription subscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false);

            var operation = Client.GetPreDefinedTag(new ResourceIdentifier($"/subscriptions/{subscription.Id.SubscriptionId}/tagNames/fakeTagName"));

            Assert.NotNull(operation.Id.SubscriptionId);
            Assert.AreEqual(operation.Id.SubscriptionId, TestEnvironment.SubscriptionId);
        }
        public async Task GetTagsOperation()
        {
            _predefinedTag = null;
            Subscription subscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false);

            var    operation = Client.GetPreDefinedTag($"/subscriptions/{subscription.Id.SubscriptionId}/tagNames/fakeTagName");
            string subscriptionId;

            Assert.IsTrue(operation.Id.TryGetSubscriptionId(out subscriptionId));
            Assert.AreEqual(subscriptionId, TestEnvironment.SubscriptionId);
        }
        public async Task List()
        {
            var tagName    = Recording.GenerateAssetName("tagName");
            var collection = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetPredefinedTags();
            var tagLro     = await collection.CreateOrUpdateAsync(tagName);

            _predefinedTag = tagLro.Value;
            var result = await collection.GetAllAsync().ToEnumerableAsync();

            Assert.GreaterOrEqual(result.Count, 1, "List result less than 1");
            var expectTag = result.Where(x => x.Data.TagName.StartsWith("tagName")).FirstOrDefault();

            Assert.NotNull(expectTag);
        }
Exemplo n.º 6
0
        public async Task StartDelete()
        {
            var tagName         = Recording.GenerateAssetName("tagName");
            var collection      = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetPredefinedTags();
            var preDefinedTagOp = InstrumentOperation(await collection.CreateOrUpdateAsync(tagName).ConfigureAwait(false));

            _predefinedTag = preDefinedTagOp.Value;
            await _predefinedTag.DeleteAsync(tagName, false).ConfigureAwait(false);

            var listResult = await collection.GetAllAsync().ToEnumerableAsync();

            var expectTag = listResult.Where(x => x.Data.TagName.Equals(tagName)).FirstOrDefault();

            Assert.IsNull(expectTag);
        }
Exemplo n.º 7
0
        public async Task DeleteTag()
        {
            var tagName         = Recording.GenerateAssetName("tagName");
            var container       = Client.DefaultSubscription.GetPredefinedTags();
            var preDefinedTagOp = await container.CreateOrUpdateAsync(tagName).ConfigureAwait(false);

            PredefinedTag preDefinedTag = preDefinedTagOp.Value;
            await preDefinedTag.DeleteAsync(tagName).ConfigureAwait(false);

            var listResult = await container.GetAllAsync().ToEnumerableAsync();

            var expectTag = listResult.Where(x => x.Data.TagName.Equals(tagName)).FirstOrDefault();

            Assert.IsNull(expectTag);
        }
Exemplo n.º 8
0
        public async Task ValueTest()
        {
            var tagName         = Recording.GenerateAssetName("tagName");
            var collection      = (await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetPredefinedTags();
            var preDefinedTagOp = await collection.CreateOrUpdateAsync(tagName).ConfigureAwait(false);

            _predefinedTag = preDefinedTagOp.Value;
            // Assert create tag value
            var createValue = await _predefinedTag.CreateOrUpdateValueAsync(tagName, "testValue").ConfigureAwait(false);

            Assert.IsTrue(createValue.Value.TagValueValue.Equals("testValue"));
            // Assert delete tag value
            await _predefinedTag.DeleteValueAsync(tagName, "testValue").ConfigureAwait(false);

            var listResult = await collection.GetAllAsync().ToEnumerableAsync();

            var expectTag   = listResult.Where(x => x.Data.TagName == tagName).FirstOrDefault();
            var expectValue = expectTag.Data.Values.Where(x => x.TagValueValue == "testValue").FirstOrDefault();

            Assert.IsNull(expectValue);
        }
Exemplo n.º 9
0
        public static ITrace AnnotateWith(this ITrace source, PredefinedTag tag, bool value)
        {
            source.AnnotateWith(new BinaryAnnotation(ToStringTag(tag), value));

            return(source);
        }
Exemplo n.º 10
0
        private static string ToStringTag(PredefinedTag tag)
        {
            switch (tag)
            {
            case PredefinedTag.ClientSend:
                return(StandardAnnotationKeys.ClientSend);

            case PredefinedTag.ClientRecv:
                return(StandardAnnotationKeys.ClientRecv);

            case PredefinedTag.ServerSend:
                return(StandardAnnotationKeys.ServerSend);

            case PredefinedTag.ServerRecv:
                return(StandardAnnotationKeys.ServerRecv);

            case PredefinedTag.WireSend:
                return(StandardAnnotationKeys.WireSend);

            case PredefinedTag.WireRecv:
                return(StandardAnnotationKeys.WireRecv);

            case PredefinedTag.ClientSendFragment:
                return(StandardAnnotationKeys.ClientSendFragment);

            case PredefinedTag.ClientRecvFragment:
                return(StandardAnnotationKeys.ClientRecvFragment);

            case PredefinedTag.ServerSendFragment:
                return(StandardAnnotationKeys.ServerSendFragment);

            case PredefinedTag.ServerRecvFragment:
                return(StandardAnnotationKeys.ServerRecvFragment);

            case PredefinedTag.ClientAddr:
                return(StandardAnnotationKeys.ClientAddr);

            case PredefinedTag.ServerAddr:
                return(StandardAnnotationKeys.ServerAddr);

            case PredefinedTag.LocalComponent:
                return(StandardAnnotationKeys.ServerAddr);

            case PredefinedTag.Error:
                return(StandardAnnotationKeys.Error);


            case PredefinedTag.HttpHost:
                return(CustomAnnotationKeys.HttpHost);

            case PredefinedTag.HttpMethod:
                return(CustomAnnotationKeys.HttpMethod);

            case PredefinedTag.HttpPath:
                return(CustomAnnotationKeys.HttpPath);

            case PredefinedTag.SqlQuery:
                return(CustomAnnotationKeys.SqlQuery);

            default:
                return(string.Empty);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Adds an annotation specified with the tag.
        /// </summary>
        public static ITrace TimeAnnotateWith(this ITrace source, PredefinedTag tag)
        {
            source.TimeAnnotateWith(ToStringTag(tag));

            return(source);
        }