-
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
64 changed files
with
2,544 additions
and
303 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using PluginManager; | ||
using PluginManager.Abstractions; | ||
|
||
namespace GSendTests.Mocks | ||
{ | ||
internal class MockLogger : ILogger | ||
{ | ||
public List<string> LogItems { get; } = new List<string>(); | ||
|
||
public void AddToLog(in LogLevel logLevel, in string data) | ||
{ | ||
LogItems.Add($"{logLevel} - {data}"); | ||
} | ||
|
||
public void AddToLog(in LogLevel logLevel, in Exception exception) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void AddToLog(in LogLevel logLevel, in Exception exception, string data) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void AddToLog(in LogLevel logLevel, in string moduleName, in string data) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void AddToLog(in LogLevel logLevel, in string moduleName, in Exception exception) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void AddToLog(in LogLevel logLevel, in string moduleName, in Exception exception, string data) | ||
{ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using System.Drawing; | ||
|
||
using GSendShared.Models; | ||
using GSendShared.Plugins; | ||
|
||
namespace GSendTests.Mocks | ||
{ | ||
internal sealed class MockPluginMenu : IPluginMenu | ||
{ | ||
private ISenderPluginHost _senderPluginHost; | ||
|
||
public MockPluginMenu(string name, int index, MenuType menuType, MenuParent menuParent) | ||
{ | ||
Text = name; | ||
Index = index; | ||
MenuType = menuType; | ||
ParentMenu = menuParent; | ||
} | ||
|
||
public MockPluginMenu(string name, MenuType menuType, MenuParent menuParent) | ||
: this(name, -1, menuType, menuParent) | ||
{ | ||
|
||
} | ||
|
||
public string Text { get; set; } | ||
|
||
public int Index { get; set; } | ||
|
||
public Image MenuImage => null; | ||
|
||
public MenuType MenuType { get; set; } | ||
|
||
public MenuParent ParentMenu { get; set; } | ||
|
||
public bool IsEnabled() | ||
{ | ||
return true; | ||
} | ||
|
||
public bool IsChecked() | ||
{ | ||
return false; | ||
} | ||
|
||
public void Clicked() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void MachineStatusChanged(MachineStateModel machineStateModel) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void UpdateHost<T>(T senderPluginHost) | ||
{ | ||
_senderPluginHost = senderPluginHost as ISenderPluginHost; | ||
} | ||
|
||
public bool GetShortcut(out string groupName, out string shortcutName) | ||
{ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Drawing; | ||
|
||
using GSendShared.Models; | ||
using GSendShared.Plugins; | ||
|
||
namespace GSendTests.Mocks | ||
{ | ||
[ExcludeFromCodeCoverage] | ||
internal class MockPluginToolbarButton : IPluginToolbarButton | ||
{ | ||
public MockPluginToolbarButton(string text, int index) | ||
{ | ||
Text = text; | ||
Index = index; | ||
} | ||
|
||
public ButtonType ButtonType => ButtonType.Button; | ||
|
||
public Image Picture => null; | ||
|
||
public string Text { get; private set; } | ||
|
||
public int Index { get; private set; } | ||
|
||
public void Clicked() | ||
{ | ||
// not used in this context | ||
} | ||
|
||
public bool IsEnabled() => true; | ||
|
||
public void MachineStatusChanged(MachineStateModel machineStateModel) | ||
{ | ||
// not used in this context | ||
} | ||
|
||
public void UpdateHost<T>(T senderPluginHost) | ||
{ | ||
// not used in this context | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/GCATests/Plugins/GrblTuningWizardTests/GSendProTuningWizardPluginTests.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,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using GrblTuningWizard; | ||
|
||
using GSendShared.Interfaces; | ||
using GSendShared.Plugins; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace GSendTests.Plugins.GrblTuningWizardTests | ||
{ | ||
[TestClass] | ||
[ExcludeFromCodeCoverage] | ||
public sealed class GSendProTuningWizardPluginTests | ||
{ | ||
[TestMethod] | ||
public void Create_ValidInstance_Success() | ||
{ | ||
GSendProTuningWizardPlugin sut = new(); | ||
Assert.IsNotNull(sut); | ||
Assert.AreEqual("GRBL Tuning Wizard", sut.Name); | ||
Assert.AreEqual(1u, sut.Version); | ||
Assert.AreEqual(PluginHosts.Sender, sut.Host); | ||
Assert.AreEqual(PluginOptions.HasMenuItems, sut.Options); | ||
} | ||
|
||
[TestMethod] | ||
public void Validate_MenuItems_Success() | ||
{ | ||
GSendProTuningWizardPlugin sut = new(); | ||
|
||
IReadOnlyList<IPluginMenu> menuItems = sut.MenuItems; | ||
|
||
Assert.AreEqual(1, menuItems.Count); | ||
Assert.AreEqual("Tuning Wizard", menuItems[0].Text); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/GCATests/Plugins/GrblTuningWizardTests/TuningWizardMenuTests.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,25 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
using GrblTuningWizard; | ||
|
||
using GSendShared.Plugins; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace GSendTests.Plugins.GrblTuningWizardTests | ||
{ | ||
[TestClass] | ||
[ExcludeFromCodeCoverage] | ||
public class TuningWizardMenuTests | ||
{ | ||
[TestMethod] | ||
public void ConstructValidInstance_Success() | ||
{ | ||
TuningWizardMenuItem sut = new TuningWizardMenuItem(); | ||
Assert.AreEqual("Tuning Wizard", sut.Text); | ||
Assert.AreEqual(-1, sut.Index); | ||
Assert.AreEqual(MenuType.MenuItem, sut.MenuType); | ||
Assert.AreEqual(MenuParent.Tools, sut.ParentMenu); | ||
} | ||
} | ||
} |
Oops, something went wrong.