-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from qJake/1.4.1-prep
v1.5: Supervisor API Support
- Loading branch information
Showing
23 changed files
with
498 additions
and
354 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
using HADotNet.Core; | ||
using HADotNet.Core.Clients; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Tests | ||
{ | ||
public class ConfigTests | ||
{ | ||
private Uri Instance { get; set; } | ||
private string ApiKey { get; set; } | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
Instance = new Uri(Environment.GetEnvironmentVariable("HADotNet:Tests:Instance")); | ||
ApiKey = Environment.GetEnvironmentVariable("HADotNet:Tests:ApiKey"); | ||
|
||
ClientFactory.Initialize(Instance, ApiKey); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveConfiguration() | ||
{ | ||
var client = ClientFactory.GetClient<ConfigClient>(); | ||
|
||
var config = await client.GetConfiguration(); | ||
|
||
Assert.IsNotNull(config); | ||
Assert.IsNotNull(config.UnitSystem); | ||
Assert.AreNotEqual(0, config.Components.Count); | ||
|
||
} | ||
} | ||
using HADotNet.Core.Clients; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace HADotNet.Core.Tests | ||
{ | ||
public class ConfigTests | ||
{ | ||
private Uri Instance { get; set; } | ||
private string ApiKey { get; set; } | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
Instance = new Uri(Environment.GetEnvironmentVariable("HADotNet:Tests:Instance")); | ||
ApiKey = Environment.GetEnvironmentVariable("HADotNet:Tests:ApiKey"); | ||
|
||
ClientFactory.Initialize(Instance, ApiKey); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveConfiguration() | ||
{ | ||
var client = ClientFactory.GetClient<ConfigClient>(); | ||
|
||
var config = await client.GetConfiguration(); | ||
|
||
Assert.IsNotNull(config); | ||
Assert.IsNotNull(config.UnitSystem); | ||
Assert.AreNotEqual(0, config.Components.Count); | ||
|
||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,34 +1,33 @@ | ||
using HADotNet.Core; | ||
using HADotNet.Core.Clients; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Tests | ||
{ | ||
public class DiscoveryTests | ||
{ | ||
private Uri Instance { get; set; } | ||
private string ApiKey { get; set; } | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
Instance = new Uri(Environment.GetEnvironmentVariable("HADotNet:Tests:Instance")); | ||
ApiKey = Environment.GetEnvironmentVariable("HADotNet:Tests:ApiKey"); | ||
|
||
ClientFactory.Initialize(Instance, ApiKey); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveDiscoveryInfo() | ||
{ | ||
var client = ClientFactory.GetClient<DiscoveryClient>(); | ||
|
||
var discovery = await client.GetDiscoveryInfo(); | ||
|
||
Assert.IsNotNull(discovery); | ||
Assert.IsNotEmpty(discovery.LocationName); | ||
} | ||
} | ||
using HADotNet.Core.Clients; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace HADotNet.Core.Tests | ||
{ | ||
public class DiscoveryTests | ||
{ | ||
private Uri Instance { get; set; } | ||
private string ApiKey { get; set; } | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
Instance = new Uri(Environment.GetEnvironmentVariable("HADotNet:Tests:Instance")); | ||
ApiKey = Environment.GetEnvironmentVariable("HADotNet:Tests:ApiKey"); | ||
|
||
ClientFactory.Initialize(Instance, ApiKey); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveDiscoveryInfo() | ||
{ | ||
var client = ClientFactory.GetClient<DiscoveryClient>(); | ||
|
||
var discovery = await client.GetDiscoveryInfo(); | ||
|
||
Assert.IsNotNull(discovery); | ||
Assert.IsNotEmpty(discovery.LocationName); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,46 +1,46 @@ | ||
using HADotNet.Core; | ||
using HADotNet.Core.Clients; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Tests | ||
{ | ||
public class EntityTests | ||
{ | ||
private Uri Instance { get; set; } | ||
private string ApiKey { get; set; } | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
Instance = new Uri(Environment.GetEnvironmentVariable("HADotNet:Tests:Instance")); | ||
ApiKey = Environment.GetEnvironmentVariable("HADotNet:Tests:ApiKey"); | ||
|
||
ClientFactory.Initialize(Instance, ApiKey); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveEntityList() | ||
{ | ||
var client = ClientFactory.GetClient<EntityClient>(); | ||
|
||
var entities = await client.GetEntities(); | ||
|
||
Assert.IsNotNull(entities); | ||
Assert.AreNotEqual(0, entities.Count()); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveEntityListWithDomainFilter() | ||
{ | ||
var client = ClientFactory.GetClient<EntityClient>(); | ||
|
||
var entities = await client.GetEntities("light"); | ||
|
||
Assert.IsNotNull(entities); | ||
Assert.AreNotEqual(0, entities.Count()); | ||
} | ||
} | ||
using HADotNet.Core; | ||
using HADotNet.Core.Clients; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace HADotNet.Core.Tests | ||
{ | ||
public class EntityTests | ||
{ | ||
private Uri Instance { get; set; } | ||
private string ApiKey { get; set; } | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
Instance = new Uri(Environment.GetEnvironmentVariable("HADotNet:Tests:Instance")); | ||
ApiKey = Environment.GetEnvironmentVariable("HADotNet:Tests:ApiKey"); | ||
|
||
ClientFactory.Initialize(Instance, ApiKey); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveEntityList() | ||
{ | ||
var client = ClientFactory.GetClient<EntityClient>(); | ||
|
||
var entities = await client.GetEntities(); | ||
|
||
Assert.IsNotNull(entities); | ||
Assert.AreNotEqual(0, entities.Count()); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveEntityListWithDomainFilter() | ||
{ | ||
var client = ClientFactory.GetClient<EntityClient>(); | ||
|
||
var entities = await client.GetEntities("light"); | ||
|
||
Assert.IsNotNull(entities); | ||
Assert.AreNotEqual(0, entities.Count()); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,37 +1,37 @@ | ||
using HADotNet.Core; | ||
using HADotNet.Core.Clients; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Tests | ||
{ | ||
public class ErrorLogTests | ||
{ | ||
private Uri Instance { get; set; } | ||
private string ApiKey { get; set; } | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
Instance = new Uri(Environment.GetEnvironmentVariable("HADotNet:Tests:Instance")); | ||
ApiKey = Environment.GetEnvironmentVariable("HADotNet:Tests:ApiKey"); | ||
|
||
ClientFactory.Initialize(Instance, ApiKey); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveErrorLogList() | ||
{ | ||
var client = ClientFactory.GetClient<ErrorLogClient>(); | ||
|
||
var log = await client.GetErrorLogEntries(); | ||
|
||
Assert.IsNotNull(log); | ||
Assert.AreNotEqual(0, log.LogEntries.Count); | ||
Assert.AreNotEqual(0, log.Errors.Count); | ||
Assert.AreNotEqual(0, log.Warnings.Count); | ||
Assert.AreEqual(7, log[7].Count); | ||
} | ||
} | ||
using HADotNet.Core; | ||
using HADotNet.Core.Clients; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace HADotNet.Core.Tests | ||
{ | ||
public class ErrorLogTests | ||
{ | ||
private Uri Instance { get; set; } | ||
private string ApiKey { get; set; } | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
Instance = new Uri(Environment.GetEnvironmentVariable("HADotNet:Tests:Instance")); | ||
ApiKey = Environment.GetEnvironmentVariable("HADotNet:Tests:ApiKey"); | ||
|
||
ClientFactory.Initialize(Instance, ApiKey); | ||
} | ||
|
||
[Test] | ||
public async Task ShouldRetrieveErrorLogList() | ||
{ | ||
var client = ClientFactory.GetClient<ErrorLogClient>(); | ||
|
||
var log = await client.GetErrorLogEntries(); | ||
|
||
Assert.IsNotNull(log); | ||
Assert.AreNotEqual(0, log.LogEntries.Count); | ||
Assert.AreNotEqual(0, log.Errors.Count); | ||
Assert.AreNotEqual(0, log.Warnings.Count); | ||
Assert.AreEqual(7, log[7].Count); | ||
} | ||
} | ||
} |
Oops, something went wrong.