-
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
4 changed files
with
66 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NppKate.Common; | ||
|
||
namespace NppKateTest.CommandManager | ||
{ | ||
[TestClass] | ||
public class CmdManagerTest | ||
{ | ||
const string Module = "Test"; | ||
const string Module2 = "Test2"; | ||
[TestMethod] | ||
public void CheckDoubleSeparator() | ||
{ | ||
var cmdManager = new NppKate.Common.CommandManager(); | ||
cmdManager.RegisterCommand(Module, "1"); | ||
cmdManager.RegisterSeparator(Module); | ||
cmdManager.RegisterSeparator(Module); | ||
|
||
Assert.AreEqual<int>(cmdManager.GetCommandsByModule(Module).Count, 2); | ||
} | ||
|
||
[TestMethod] | ||
public void CheckFirstSeparator() | ||
{ | ||
var cmdManager = new NppKate.Common.CommandManager(); | ||
cmdManager.RegisterSeparator(Module); | ||
|
||
Assert.AreEqual<int>(cmdManager.GetCommandsByModule(Module).Count, 0); | ||
} | ||
|
||
private void AddCommands(ICommandManager cmd, int count, string module) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
cmd.RegisterCommand(module, $"command_{i}"); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void AddOneCommand() | ||
{ | ||
var cmdManager = new NppKate.Common.CommandManager(); | ||
AddCommands(cmdManager, 1, Module); | ||
Assert.AreEqual<int>(cmdManager.GetCommandsByModule(Module).Count, 1); | ||
} | ||
[TestMethod] | ||
public void AddManyCommand() | ||
{ | ||
var cmdManager = new NppKate.Common.CommandManager(); | ||
var count = 10; | ||
AddCommands(cmdManager, count, Module); | ||
Assert.AreEqual<int>(cmdManager.GetCommandsByModule(Module).Count, 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