diff --git a/src/App/NetDaemon.App/Common/NetDaemonApp.cs b/src/App/NetDaemon.App/Common/NetDaemonApp.cs index b07c57541..560023c96 100644 --- a/src/App/NetDaemon.App/Common/NetDaemonApp.cs +++ b/src/App/NetDaemon.App/Common/NetDaemonApp.cs @@ -15,7 +15,7 @@ namespace JoySoftware.HomeAssistant.NetDaemon.Common /// /// Base class för all NetDaemon apps /// - public class NetDaemonApp : INetDaemonApp, INetDaemonBase + public abstract class NetDaemonApp : INetDaemonApp, INetDaemonBase { private INetDaemon? _daemon; diff --git a/tests/NetDaemon.Daemon.Tests/DaemonHostTestBase.cs b/tests/NetDaemon.Daemon.Tests/DaemonHostTestBase.cs index 003ba4490..567c31221 100644 --- a/tests/NetDaemon.Daemon.Tests/DaemonHostTestBase.cs +++ b/tests/NetDaemon.Daemon.Tests/DaemonHostTestBase.cs @@ -10,7 +10,9 @@ namespace NetDaemon.Daemon.Tests { - public partial class DaemonHostTestaBase + public class BaseTestApp : JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp { } + + public partial class DaemonHostTestBase { private readonly LoggerMock _loggerMock; private readonly HassClientMock _defaultHassClientMock; @@ -19,13 +21,13 @@ public partial class DaemonHostTestaBase private readonly NetDaemonHost _notConnectedDaemonHost; private readonly INetDaemonApp _defaultDaemonApp; - internal DaemonHostTestaBase() + internal DaemonHostTestBase() { _loggerMock = new LoggerMock(); _defaultHassClientMock = HassClientMock.DefaultMock; _defaultDataRepositoryMock = new Mock(); _defaultDaemonHost = new NetDaemonHost(_defaultHassClientMock.Object, _defaultDataRepositoryMock.Object, _loggerMock.LoggerFactory); - _defaultDaemonApp = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + _defaultDaemonApp = new BaseTestApp(); _defaultDaemonApp.StartUpAsync(_defaultDaemonHost); _notConnectedDaemonHost = new NetDaemonHost(HassClientMock.MockConnectFalse.Object, _defaultDataRepositoryMock.Object, _loggerMock.LoggerFactory); diff --git a/tests/NetDaemon.Daemon.Tests/Demon/DataRepositoryTests.cs b/tests/NetDaemon.Daemon.Tests/Demon/DataRepositoryTests.cs index 2b2717c19..9507fbfcb 100644 --- a/tests/NetDaemon.Daemon.Tests/Demon/DataRepositoryTests.cs +++ b/tests/NetDaemon.Daemon.Tests/Demon/DataRepositoryTests.cs @@ -10,11 +10,11 @@ namespace NetDaemon.Daemon.Tests.Daemon { - public class DataRepositoryTests : DaemonHostTestaBase + public class DataRepositoryTests : DaemonHostTestBase { public static readonly string DataReposityryPath = Path.Combine(AppContext.BaseDirectory, "datarepository"); - + public DataRepositoryTests() : base() { } diff --git a/tests/NetDaemon.Daemon.Tests/Demon/NetDaemonHostTests.cs b/tests/NetDaemon.Daemon.Tests/Demon/NetDaemonHostTests.cs index 6bff15188..892877bf4 100644 --- a/tests/NetDaemon.Daemon.Tests/Demon/NetDaemonHostTests.cs +++ b/tests/NetDaemon.Daemon.Tests/Demon/NetDaemonHostTests.cs @@ -11,7 +11,12 @@ namespace NetDaemon.Daemon.Tests.Daemon { - public class NetDaemonTests : DaemonHostTestaBase + public class HostTestApp : JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp + { + + } + + public class NetDaemonTests : DaemonHostTestBase { public NetDaemonTests() : base() { @@ -532,7 +537,7 @@ public async Task DelayStateChangeCancelShouldReturnFalse() public void RegisterAppShouldReturnCorrectAppWhenUsingGetApp() { // ARRANGE - DefaultDaemonHost.RegisterAppInstance("appx", new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp()); + DefaultDaemonHost.RegisterAppInstance("appx", new HostTestApp()); // ACT var theApp = DefaultDaemonHost.GetApp("appx"); @@ -555,7 +560,7 @@ public void GetAppOnMissingAppShouldReturnNull() public void ClearShouldReturnNullGetApp() { // ARRANGE - DefaultDaemonHost.RegisterAppInstance("appx", new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp()); + DefaultDaemonHost.RegisterAppInstance("appx", new HostTestApp()); var theApp = DefaultDaemonHost.GetApp("appx"); Assert.NotNull(theApp); diff --git a/tests/NetDaemon.Daemon.Tests/Fluent/FluentCameraTests.cs b/tests/NetDaemon.Daemon.Tests/Fluent/FluentCameraTests.cs index f0bc3c442..e6a5eabbe 100644 --- a/tests/NetDaemon.Daemon.Tests/Fluent/FluentCameraTests.cs +++ b/tests/NetDaemon.Daemon.Tests/Fluent/FluentCameraTests.cs @@ -14,7 +14,7 @@ namespace NetDaemon.Daemon.Tests /// Mainly the tests checks if correct underlying call to "CallService" /// has been made. /// - public class FluentCameraTests : DaemonHostTestaBase + public class FluentCameraTests : DaemonHostTestBase { public FluentCameraTests() : base() { diff --git a/tests/NetDaemon.Daemon.Tests/Fluent/FluentEventTests.cs b/tests/NetDaemon.Daemon.Tests/Fluent/FluentEventTests.cs index afc0f45cf..083fa8f78 100644 --- a/tests/NetDaemon.Daemon.Tests/Fluent/FluentEventTests.cs +++ b/tests/NetDaemon.Daemon.Tests/Fluent/FluentEventTests.cs @@ -8,6 +8,8 @@ namespace NetDaemon.Daemon.Tests { + public class FluentTestApp : JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp { } + public class FluentEventTests { [Fact] @@ -16,7 +18,7 @@ public async Task ACustomEventShouldDoCorrectCall() // ARRANGE var hcMock = HassClientMock.DefaultMock; var daemonHost = new NetDaemonHost(hcMock.Object, new Mock().Object); - var app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + var app = new FluentTestApp(); await app.StartUpAsync(daemonHost); dynamic dynObject = new ExpandoObject(); @@ -56,7 +58,7 @@ public void ACustomEventNullValueCallThrowsNullReferenceException() // ARRANGE var hcMock = HassClientMock.DefaultMock; var daemonHost = new NetDaemonHost(hcMock.Object, new Mock().Object); - var app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + var app = new FluentTestApp(); app.StartUpAsync(daemonHost); var cancelSource = hcMock.GetSourceWithTimeout(); @@ -72,7 +74,7 @@ public async Task ACustomEventShouldUsingSelectorFuncDoCorrectCall() // ARRANGE var hcMock = HassClientMock.DefaultMock; var daemonHost = new NetDaemonHost(hcMock.Object, new Mock().Object); - var app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + var app = new FluentTestApp(); await app.StartUpAsync(daemonHost); dynamic dynObject = new ExpandoObject(); @@ -112,7 +114,7 @@ public async Task ACustomEventsShouldDoCorrectCall() // ARRANGE var hcMock = HassClientMock.DefaultMock; var daemonHost = new NetDaemonHost(hcMock.Object, new Mock().Object); - var app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + var app = new FluentTestApp(); await app.StartUpAsync(daemonHost); dynamic dynObject = new ExpandoObject(); @@ -152,7 +154,7 @@ public async Task ACustomEventShouldUsingSelectorUsingDataFuncDoCorrectCall() // ARRANGE var hcMock = HassClientMock.DefaultMock; var daemonHost = new NetDaemonHost(hcMock.Object, new Mock().Object); - var app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + var app = new FluentTestApp(); await app.StartUpAsync(daemonHost); dynamic dynObject = new ExpandoObject(); @@ -192,7 +194,7 @@ public async Task ACustomEventShouldUsingSelectorUsingDataFuncNotCall() // ARRANGE var hcMock = HassClientMock.DefaultMock; var daemonHost = new NetDaemonHost(hcMock.Object, new Mock().Object); - var app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + var app = new FluentTestApp(); await app.StartUpAsync(daemonHost); dynamic dynObject = new ExpandoObject(); @@ -231,7 +233,7 @@ public async Task ACustomEventShouldUsingSelectorUsingDataNotExisstFuncNotCall() // ARRANGE var hcMock = HassClientMock.DefaultMock; var daemonHost = new NetDaemonHost(hcMock.Object, new Mock().Object); - var app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + var app = new FluentTestApp(); await app.StartUpAsync(daemonHost); dynamic dynObject = new ExpandoObject(); dynObject.Test = "Hello World!"; diff --git a/tests/NetDaemon.Daemon.Tests/Fluent/FluentTests.cs b/tests/NetDaemon.Daemon.Tests/Fluent/FluentTests.cs index b19b68d5e..3197c0671 100644 --- a/tests/NetDaemon.Daemon.Tests/Fluent/FluentTests.cs +++ b/tests/NetDaemon.Daemon.Tests/Fluent/FluentTests.cs @@ -16,7 +16,7 @@ namespace NetDaemon.Daemon.Tests /// Mainly the tests checks if correct underlying call to "CallService" /// has been made. /// - public class FluentTests : DaemonHostTestaBase + public class FluentTests : DaemonHostTestBase { public FluentTests() : base() { diff --git a/tests/NetDaemon.Daemon.Tests/NetDaemonApp/FaultyAppsTests.cs b/tests/NetDaemon.Daemon.Tests/NetDaemonApp/FaultyAppsTests.cs index 500d8586f..bc0b3bbf0 100644 --- a/tests/NetDaemon.Daemon.Tests/NetDaemonApp/FaultyAppsTests.cs +++ b/tests/NetDaemon.Daemon.Tests/NetDaemonApp/FaultyAppsTests.cs @@ -14,7 +14,9 @@ namespace NetDaemon.Daemon.Tests.NetDaemonApp { - public class FaultyAppTests : DaemonHostTestaBase + public class DaemonAppTestApp : JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp { } + + public class FaultyAppTests : DaemonHostTestBase { private readonly JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp _app; @@ -22,7 +24,7 @@ public class FaultyAppTests : DaemonHostTestaBase public FaultyAppTests() : base() { - _app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + _app = new DaemonAppTestApp(); _app.StartUpAsync(DefaultDaemonHost); } diff --git a/tests/NetDaemon.Daemon.Tests/NetDaemonApp/NetDaemonAppTests.cs b/tests/NetDaemon.Daemon.Tests/NetDaemonApp/NetDaemonAppTests.cs index 548378776..4008d2d2d 100644 --- a/tests/NetDaemon.Daemon.Tests/NetDaemonApp/NetDaemonAppTests.cs +++ b/tests/NetDaemon.Daemon.Tests/NetDaemonApp/NetDaemonAppTests.cs @@ -8,6 +8,8 @@ namespace NetDaemon.Daemon.Tests.NetDaemonApp { + public class AppTestApp : JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp { } + public class NetDaemonApptests { private readonly LoggerMock _logMock; @@ -22,7 +24,7 @@ public NetDaemonApptests() _netDaemonMock = new Mock(); _netDaemonMock.SetupGet(n => n.Logger).Returns(_logMock.Logger); - _app = new JoySoftware.HomeAssistant.NetDaemon.Common.NetDaemonApp(); + _app = new AppTestApp(); _app.StartUpAsync(_netDaemonMock.Object); _app.Id = "app"; }