コード例 #1
0
        public void ConstructsDictionaryForProviderWitMultipleResourceTypes()
        {
            List <Provider> ProviderList = new List <Provider>();
            var             provider     = new Provider(
                namespaceProperty: "Microsoft.Mock",
                resourceTypes: new[]
            {
                new ProviderResourceType
                {
                    Locations    = new[] { "westus" },
                    ResourceType = "mock1",
                },
                new ProviderResourceType
                {
                    Locations    = new[] { "westus" },
                    ResourceType = "mock2",
                }
            });

            ProviderList.Add(provider);

            var resourceTypeLocationDictionary = LocationCompleterAttribute.CreateLocationDictionary(ProviderList);

            var matchingDictionary = new ConcurrentDictionary <string, ICollection <string> >();

            matchingDictionary.TryAdd("Microsoft.Mock/mock1", new string[] { "westus" });
            matchingDictionary.TryAdd("Microsoft.Mock/mock2", new string[] { "westus" });
            Assert.Equal(resourceTypeLocationDictionary, matchingDictionary);
        }
コード例 #2
0
        public void ConstructsDictionaryForProviderWithNoResourceTypes()
        {
            List <Provider> ProviderList = new List <Provider>();
            var             provider     = new Provider(
                namespaceProperty: "Microsoft.Mock",
                resourceTypes: new ProviderResourceType[] { });

            ProviderList.Add(provider);

            var resourceTypeLocationDictionary = LocationCompleterAttribute.CreateLocationDictionary(ProviderList);

            Assert.Empty(resourceTypeLocationDictionary);
        }
コード例 #3
0
        public void ConstructsEmptyDictionaryForNoProviders()
        {
            var resourceTypeLocationDictionary = LocationCompleterAttribute.CreateLocationDictionary(new List <Provider>());

            Assert.Empty(resourceTypeLocationDictionary);
        }