-
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
Showing
55 changed files
with
1,461 additions
and
461 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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
|
||
using GSendShared; | ||
using GSendShared.Abstractions; | ||
|
||
namespace GSendTests.Mocks | ||
{ | ||
internal class MockGSendContext : IGSendContext | ||
{ | ||
public MockGSendContext() | ||
{ | ||
} | ||
|
||
public MockGSendContext(IServiceProvider serviceProvider) | ||
: this() | ||
{ | ||
ServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); | ||
} | ||
|
||
public IServiceProvider ServiceProvider { get; set; } | ||
|
||
public bool IsClosing => throw new NotImplementedException(); | ||
|
||
public IGSendSettings Settings => throw new NotImplementedException(); | ||
|
||
public void CloseContext() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void ShowMachine(IMachine machine) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
src/GCATests/Plugins/HeartbeatTests/HeartbeatControlItemTests.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,48 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
using GSendControls.Abstractions; | ||
using GSendControls.Plugins.InternalPlugins.Hearbeats; | ||
|
||
using GSendShared.Plugins; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace GSendTests.Plugins.HeartbeatTests | ||
{ | ||
[TestClass] | ||
[ExcludeFromCodeCoverage] | ||
public sealed class HeartbeatControlItemTests | ||
{ | ||
[TestMethod] | ||
public void Construct_ValidInstance_Success() | ||
{ | ||
HeartbeatControlItem sut = new(); | ||
Assert.IsNotNull(sut); | ||
Assert.IsInstanceOfType<IPluginControl>(sut); | ||
Assert.AreEqual("Graphs", sut.Name); | ||
Assert.IsNotNull(sut.Control); | ||
Assert.AreEqual(ControlLocation.Secondary, sut.Location); | ||
Assert.AreEqual("Heartbeat Graphs", sut.Text); | ||
Assert.AreEqual(20, sut.Index); | ||
Assert.IsTrue(sut.ReceiveClientMessages); | ||
Assert.IsTrue(sut.IsEnabled()); | ||
} | ||
|
||
[TestMethod] | ||
public void ClientMessageReceived_DoesNotThrowException() | ||
{ | ||
HeartbeatControlItem sut = new(); | ||
bool exceptionRaised = false; | ||
try | ||
{ | ||
sut.UpdateHost<object>(null); | ||
} | ||
catch | ||
{ | ||
exceptionRaised = true; | ||
} | ||
|
||
Assert.IsFalse(exceptionRaised); | ||
} | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
src/GCATests/Plugins/HeartbeatTests/HeartbeatsPluginTests.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,82 @@ | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
using GSendControls.Abstractions; | ||
using GSendControls.Plugins.InternalPlugins.Hearbeats; | ||
|
||
using GSendShared.Plugins; | ||
|
||
using GSendTests.Mocks; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace GSendTests.Plugins.HeartbeatTests | ||
{ | ||
[TestClass] | ||
[ExcludeFromCodeCoverage] | ||
public sealed class HeartbeatsPluginTests | ||
{ | ||
[TestMethod] | ||
public void Construct_ValidInstance_Success() | ||
{ | ||
HearbeatsPlugin sut = new(); | ||
Assert.IsNotNull(sut); | ||
Assert.IsInstanceOfType<IGSendPluginModule>(sut); | ||
Assert.AreEqual("Heartbeats", sut.Name); | ||
Assert.AreEqual(1u, sut.Version); | ||
Assert.AreEqual(PluginHosts.Sender, sut.Host); | ||
Assert.AreEqual(PluginOptions.HasControls, sut.Options); | ||
Assert.IsNull(sut.MenuItems); | ||
Assert.IsNull(sut.ToolbarItems); | ||
Assert.IsFalse(sut.ReceiveClientMessages); | ||
} | ||
|
||
[TestMethod] | ||
public void Validate_ControlItems_Success() | ||
{ | ||
IPluginMenu parentMenu = new MockPluginMenu("test", MenuType.MenuItem, null); | ||
MockSenderPluginHost pluginHost = new(parentMenu); | ||
|
||
HearbeatsPlugin sut = new(); | ||
sut.Initialize(pluginHost); | ||
IReadOnlyList<IPluginControl> controlItems = sut.ControlItems; | ||
|
||
Assert.AreEqual(1, controlItems.Count); | ||
Assert.AreEqual("Heartbeat Graphs", controlItems[0].Text); | ||
} | ||
|
||
[TestMethod] | ||
public void ClientMessageReceived_DoesNotThrowException() | ||
{ | ||
HearbeatsPlugin sut = new(); | ||
bool exceptionRaised = false; | ||
try | ||
{ | ||
sut.ClientMessageReceived(null); | ||
} | ||
catch | ||
{ | ||
exceptionRaised = true; | ||
} | ||
|
||
Assert.IsFalse(exceptionRaised); | ||
} | ||
|
||
[TestMethod] | ||
public void Initialize_DoesNotThrowException() | ||
{ | ||
HearbeatsPlugin sut = new(); | ||
bool exceptionRaised = false; | ||
try | ||
{ | ||
sut.Initialize(null); | ||
} | ||
catch | ||
{ | ||
exceptionRaised = true; | ||
} | ||
|
||
Assert.IsFalse(exceptionRaised); | ||
} | ||
} | ||
} |
Oops, something went wrong.