< Summary

Class:Microsoft.Azure.Search.Tests.Utilities.ResourceGroupFixture
Assembly:Search.Management.Tests
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Management.Search\tests\Utilities\ResourceGroupFixture.cs
Covered lines:12
Uncovered lines:0
Coverable lines:12
Total lines:44
Line coverage:100% (12 of 12)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Location()-100%100%
get_ResourceGroupName()-100%100%
Initialize(...)-100%100%
Cleanup()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Management.Search\tests\Utilities\ResourceGroupFixture.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.Search.Tests.Utilities
 6{
 7    using System.Linq;
 8    using Management.ResourceManager;
 9    using Management.ResourceManager.Models;
 10    using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
 11    using Xunit;
 12
 13    public class ResourceGroupFixture : IResourceFixture
 14    {
 15        private const string SearchNamespace = "Microsoft.Search";
 16
 180617        public string Location { get; private set; }
 18
 421419        public string ResourceGroupName { get; private set; }
 20
 21        public virtual void Initialize(MockContext context)
 22        {
 60223            ResourceManagementClient client = context.GetServiceClient<ResourceManagementClient>();
 24
 25            // Register subscription and get a valid location for search services.
 60226            Provider provider = client.Providers.Register(SearchNamespace);
 60227            Assert.NotNull(provider);
 28
 29            // We only support one resource type.
 60230            Location = provider.ResourceTypes.First().Locations.First();
 31
 32            // Create resource group
 60233            ResourceGroupName = SearchTestUtilities.GenerateName();
 60234            ResourceGroup resourceGroup =
 60235                client.ResourceGroups.CreateOrUpdate(ResourceGroupName, new ResourceGroup() { Location = Location });
 60236            Assert.NotNull(resourceGroup);
 60237        }
 38
 39        public virtual void Cleanup()
 40        {
 41            // Nothing to cleanup.
 60242        }
 43    }
 44}