public void ResourceCriteria_ResourceType_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var resourceCriteria = new ResourceCriteria(); var resourceType = "TestResourceType"; //-----------------Act----------------------- resourceCriteria.ResourceType = resourceType; //-----------------Assert-------------------- Assert.AreEqual(resourceType, resourceCriteria.ResourceType); }
public void ResourceCriteria_VersionInfo_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var mockVersionInfo = new Mock <IVersionInfo>(); var resourceCriteria = new ResourceCriteria(); //-----------------Act----------------------- resourceCriteria.VersionInfo = mockVersionInfo.Object; //-----------------Assert-------------------- Assert.AreEqual(mockVersionInfo.Object, resourceCriteria.VersionInfo); }
public void ResourceCriteria_ResourceID_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var resourceCriteria = new ResourceCriteria(); var resourceID = Guid.NewGuid(); //-----------------Act----------------------- resourceCriteria.ResourceID = resourceID; //-----------------Assert-------------------- Assert.AreEqual(resourceID, resourceCriteria.ResourceID); }
public void ResourceCriteria_ResourcePath_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var resourceCriteria = new ResourceCriteria(); var resourcePath = "TestResourcePath"; //-----------------Act----------------------- resourceCriteria.ResourcePath = resourcePath; //-----------------Assert-------------------- Assert.AreEqual(resourcePath, resourceCriteria.ResourcePath); }
public void ResourceCriteria_FetchAll_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var fetchAll = true; var resourceCriteria = new ResourceCriteria(); //-----------------Act----------------------- resourceCriteria.FetchAll = fetchAll; //-----------------Assert-------------------- Assert.AreEqual(fetchAll, resourceCriteria.FetchAll); }
public void ResourceCriteria_AuthorRoles_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var authorRoles = "testAuthorRoles"; var resourceCriteria = new ResourceCriteria(); //-----------------Act----------------------- resourceCriteria.AuthorRoles = authorRoles; //-----------------Assert-------------------- Assert.AreEqual(authorRoles, resourceCriteria.AuthorRoles); }
public void ResourceCriteria_IsNewResource_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var isNewResource = true; var resourceCriteria = new ResourceCriteria(); //-----------------Act----------------------- resourceCriteria.IsNewResource = isNewResource; //-----------------Assert-------------------- Assert.IsTrue(resourceCriteria.IsNewResource); }
public void ResourceCriteria_GuidCsv_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var guidCsv = "TestGuidCsv"; var resourceCriteria = new ResourceCriteria(); //-----------------Act----------------------- resourceCriteria.GuidCsv = guidCsv; //-----------------Assert-------------------- Assert.AreEqual(guidCsv, resourceCriteria.GuidCsv); }
public void ResourceCriteria_IsUpgraded_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var isUpgraded = false; var resourceCriteria = new ResourceCriteria(); //-----------------Act----------------------- resourceCriteria.IsUpgraded = isUpgraded; //-----------------Assert-------------------- Assert.AreEqual(isUpgraded, resourceCriteria.IsUpgraded); }
public void ResourceCriteria_WorkspaceId_SetProperty_Expect_SetValue() { //-----------------Arrange------------------- var workspaceId = Guid.NewGuid(); var resourceCriteria = new ResourceCriteria(); //-----------------Act----------------------- resourceCriteria.WorkspaceId = workspaceId; //-----------------Assert-------------------- Assert.AreEqual(workspaceId, resourceCriteria.WorkspaceId); }
public override string DefineQuery(ResourceCriteria criteria) { var query = GraphQueryBuilder.ForResourceType(ResourceType) .WithSubscriptionsWithIds(criteria.Subscriptions) // Filter on queried subscriptions defined in landscape .WithResourceGroupsWithName(criteria.ResourceGroups) .WithinRegions(criteria.Regions) .WithTags(criteria.Tags) .Project("subscriptionId", "resourceGroup", "type", "name") .Build(); return(query); }
public override string DefineQuery(ResourceCriteria criteria) { var query = GraphQueryBuilder.ForResourceType("microsoft.web/sites", "microsoft.web/sites/slots") .Where("kind", Operator.DoesNotContain, "functionapp") .WithSubscriptionsWithIds(criteria.Subscriptions) // Filter on queried subscriptions defined in landscape .WithResourceGroupsWithName(criteria.ResourceGroups) .WithinRegions(criteria.Regions) .WithTags(criteria.Tags) .Project("subscriptionId", "resourceGroup", "type", "name") .Build(); return(query); }
public async Task <List <Resource> > QueryAsync(string resourceType, ResourceCriteria criteria) { Guard.NotNullOrWhitespace(resourceType, nameof(resourceType)); Guard.NotNull(criteria, nameof(criteria)); Guard.NotNull(criteria.Subscriptions, nameof(criteria.Subscriptions)); Guard.NotNull(criteria.Regions, nameof(criteria.Regions)); Guard.NotNull(criteria.ResourceGroups, nameof(criteria.ResourceGroups)); Guard.NotNull(criteria.Tags, nameof(criteria.Tags)); var query = GraphQuery.ForResourceType(resourceType) .WithSubscriptionsWithIds(criteria.Subscriptions) // Filter on queried subscriptions defined in landscape .WithResourceGroupsWithName(criteria.ResourceGroups) .WithinRegions(criteria.Regions) .WithTags(criteria.Tags) .Project("subscriptionId", "resourceGroup", "type", "name", "id") .Build(); return(await QueryAsync(query, Subscriptions)); }
public abstract string DefineQuery(ResourceCriteria criteria);