Skip to content

Commit

Permalink
Merge pull request #18 from qJake/1.4.1-prep
Browse files Browse the repository at this point in the history
v1.5: Supervisor API Support
  • Loading branch information
qJake committed Jan 31, 2021
2 parents b802b1d + d7271cb commit cad2b5a
Show file tree
Hide file tree
Showing 23 changed files with 498 additions and 354 deletions.
11 changes: 5 additions & 6 deletions HADotNet.Core.Tests/AutomationTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using HADotNet.Core;
using HADotNet.Core.Clients;
using HADotNet.Core.Clients;
using HADotNet.Core.Models;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Tests
namespace HADotNet.Core.Tests
{
/// <summary>
/// The tests for <see cref="AutomationClient"/>.
Expand Down
3 changes: 1 addition & 2 deletions HADotNet.Core.Tests/CalendarTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using HADotNet.Core;
using HADotNet.Core.Clients;
using NUnit.Framework;
using System;
using System.Threading.Tasks;

namespace Tests
namespace HADotNet.Core.Tests
{
public class CalendarTests
{
Expand Down
69 changes: 34 additions & 35 deletions HADotNet.Core.Tests/ConfigTests.cs
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);

}
}
}
65 changes: 32 additions & 33 deletions HADotNet.Core.Tests/DiscoveryTests.cs
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);
}
}
}
90 changes: 45 additions & 45 deletions HADotNet.Core.Tests/EntityTests.cs
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());
}
}
}
72 changes: 36 additions & 36 deletions HADotNet.Core.Tests/ErrorLogTests.cs
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);
}
}
}

0 comments on commit cad2b5a

Please sign in to comment.