This repository has been archived by the owner on Aug 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58390c3
commit eafa1e4
Showing
6 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/Promitor.ResourceDiscovery.Tests.Integration/Services/ResourceDiscoveryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Net; | ||
using System.Threading.Tasks; | ||
using Bogus; | ||
using Newtonsoft.Json; | ||
using Promitor.ResourceDiscovery.Agent.Model; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Promitor.ResourceDiscovery.Tests.Integration.Services | ||
{ | ||
[Category("Integration")] | ||
public class ResourceDiscoveryTests : IntegrationTest | ||
{ | ||
private readonly Faker _bogusGenerator = new Faker(); | ||
|
||
public ResourceDiscoveryTests(ITestOutputHelper testOutput) | ||
: base(testOutput) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task ResourceDiscovery_GetServiceBusResources_ReturnsValidList() | ||
{ | ||
// Arrange | ||
const string resourceCollectionName = "service-bus"; | ||
var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger); | ||
|
||
// Act | ||
var response = await resourceDiscoveryClient.GetDiscoveredResourcesAsync(resourceCollectionName); | ||
|
||
// Assert | ||
Assert.Equal(HttpStatusCode.OK, response.StatusCode); | ||
var rawResponseBody = await response.Content.ReadAsStringAsync(); | ||
Assert.NotEmpty(rawResponseBody); | ||
var resources = JsonConvert.DeserializeObject<List<Resource>>(rawResponseBody); | ||
Assert.NotNull(resources); | ||
Assert.NotEmpty(resources); | ||
} | ||
|
||
[Fact] | ||
public async Task ResourceDiscovery_GetForUnexistingResourceCollection_ReturnsNotFound() | ||
{ | ||
// Arrange | ||
string resourceCollectionName = _bogusGenerator.Lorem.Word(); | ||
var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger); | ||
|
||
// Act | ||
var response = await resourceDiscoveryClient.GetDiscoveredResourcesAsync(resourceCollectionName); | ||
|
||
// Assert | ||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters