-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from benpollarduk/deep-help
Improved help to allow deeper commands help to be displayed
- Loading branch information
Showing
41 changed files
with
609 additions
and
261 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using NetAF.Assets; | ||
using NetAF.Assets.Characters; | ||
using NetAF.Assets.Locations; | ||
using NetAF.Commands.Global; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NetAF.Logic; | ||
using NetAF.Logic.Modes; | ||
using NetAF.Commands; | ||
|
||
namespace NetAF.Tests.Commands.Global | ||
{ | ||
[TestClass] | ||
public class CommandList_Tests | ||
{ | ||
[TestMethod] | ||
public void GivenNullGame_WhenInvoke_ThenError() | ||
{ | ||
var command = new CommandList(); | ||
|
||
var result = command.Invoke(null); | ||
|
||
Assert.AreEqual(ReactionResult.Error, result.Result); | ||
} | ||
|
||
[TestMethod] | ||
public void GivenValidGame_WhenInvoke_ThenGameModeChanged() | ||
{ | ||
var room = new Room(Identifier.Empty, Description.Empty); | ||
var character = new PlayableCharacter(Identifier.Empty, Description.Empty); | ||
var item = new Item(new Identifier("A"), Description.Empty, true); | ||
room.AddItem(item); | ||
var region = new Region(string.Empty, string.Empty); | ||
region.AddRoom(room, 0, 0, 0); | ||
var overworld = new Overworld(string.Empty, string.Empty); | ||
overworld.AddRegion(region); | ||
var game = Game.Create(new GameInfo(string.Empty, string.Empty, string.Empty), string.Empty, AssetGenerator.Retained(overworld, character), GameEndConditions.NoEnd, TestGameConfiguration.Default).Invoke(); | ||
game.ChangeMode(new AboutMode()); | ||
var command = new CommandList(); | ||
|
||
var result = command.Invoke(game); | ||
|
||
Assert.AreEqual(ReactionResult.GameModeChanged, result.Result); | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,31 @@ | ||
using NetAF.Logic; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NetAF.Assets.Characters; | ||
using NetAF.Assets.Locations; | ||
using NetAF.Utilities; | ||
using NetAF.Logic.Modes; | ||
using NetAF.Commands.Global; | ||
using NetAF.Commands.Scene; | ||
|
||
namespace NetAF.Tests.Logic.Modes | ||
{ | ||
[TestClass] | ||
public class CommandListMode_Tests | ||
{ | ||
[TestMethod] | ||
public void GivenNew_WhenRender_ThenNoExceptionThrown() | ||
{ | ||
Assertions.NoExceptionThrown(() => | ||
{ | ||
RegionMaker regionMaker = new(string.Empty, string.Empty); | ||
Room room = new(string.Empty, string.Empty); | ||
regionMaker[0, 0, 0] = room; | ||
OverworldMaker overworldMaker = new(string.Empty, string.Empty, regionMaker); | ||
var game = Game.Create(new(string.Empty, string.Empty, string.Empty), string.Empty, AssetGenerator.Retained(overworldMaker.Make(), new PlayableCharacter(string.Empty, string.Empty)), GameEndConditions.NoEnd, TestGameConfiguration.Default).Invoke(); | ||
var mode = new CommandListMode([End.CommandHelp, Take.CommandHelp]); | ||
|
||
mode.Render(game); | ||
}); | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
NetAF.Tests/Rendering/FrameBuilders/Console/ConsoleCommandListFrameBuilder_Tests.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,24 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NetAF.Assets; | ||
using NetAF.Commands.Scene; | ||
using NetAF.Rendering.FrameBuilders; | ||
using NetAF.Rendering.FrameBuilders.Console; | ||
|
||
namespace NetAF.Tests.Rendering.FrameBuilders.Console | ||
{ | ||
[TestClass] | ||
public class ConsoleCommandListFrameBuilder_Tests | ||
{ | ||
[TestMethod] | ||
public void GivenDefaults_WhenBuild_ThenNoException() | ||
{ | ||
Assertions.NoExceptionThrown(() => | ||
{ | ||
var gridStringBuilder = new GridStringBuilder(); | ||
var builder = new ConsoleCommandListFrameBuilder(gridStringBuilder); | ||
|
||
builder.Build(string.Empty, string.Empty, [Take.CommandHelp], new Size(80, 50)); | ||
}); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.