-
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 #95 from benpollarduk/map-functions
Map functions
- Loading branch information
Showing
100 changed files
with
1,499 additions
and
572 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using NetAF.Assets; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace NetAF.Tests.Assets | ||
{ | ||
[TestClass] | ||
public class Point2D_Tests | ||
{ | ||
[TestMethod] | ||
public void Given2PointsThatAreTheSameInXAndY_WhenEquals_ThenReturnTrue() | ||
{ | ||
var one = new Point2D(0, 0); | ||
var two = new Point2D(0, 0); | ||
|
||
var result = one.Equals(two); | ||
|
||
Assert.IsTrue(result); | ||
} | ||
|
||
[TestMethod] | ||
public void Given2PointsThatAreDifferentInX_WhenEquals_ThenReturnTrue() | ||
{ | ||
var one = new Point2D(0, 0); | ||
var two = new Point2D(1, 0); | ||
|
||
var result = one.Equals(two); | ||
|
||
Assert.IsFalse(result); | ||
} | ||
|
||
[TestMethod] | ||
public void Given2PointsThatAreDifferentInY_WhenEquals_ThenReturnTrue() | ||
{ | ||
var one = new Point2D(0, 0); | ||
var two = new Point2D(0, 1); | ||
|
||
var result = one.Equals(two); | ||
|
||
Assert.IsFalse(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using NetAF.Assets; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace NetAF.Tests.Assets | ||
{ | ||
[TestClass] | ||
public class Point3D_Tests | ||
{ | ||
[TestMethod] | ||
public void Given2PointsThatAreTheSameInXAndY_WhenEquals_ThenReturnTrue() | ||
{ | ||
var one = new Point3D(0, 0, 0); | ||
var two = new Point3D(0, 0, 0); | ||
|
||
var result = one.Equals(two); | ||
|
||
Assert.IsTrue(result); | ||
} | ||
|
||
[TestMethod] | ||
public void Given2PointsThatAreDifferentInX_WhenEquals_ThenReturnTrue() | ||
{ | ||
var one = new Point3D(0, 0, 0); | ||
var two = new Point3D(1, 0, 0); | ||
|
||
var result = one.Equals(two); | ||
|
||
Assert.IsFalse(result); | ||
} | ||
|
||
[TestMethod] | ||
public void Given2PointsThatAreDifferentInY_WhenEquals_ThenReturnTrue() | ||
{ | ||
var one = new Point3D(0, 0, 0); | ||
var two = new Point3D(0, 1, 0); | ||
|
||
var result = one.Equals(two); | ||
|
||
Assert.IsFalse(result); | ||
} | ||
|
||
[TestMethod] | ||
public void Given2PointsThatAreDifferentInZ_WhenEquals_ThenReturnTrue() | ||
{ | ||
var one = new Point3D(0, 0, 0); | ||
var two = new Point3D(0, 0, 1); | ||
|
||
var result = one.Equals(two); | ||
|
||
Assert.IsFalse(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using NetAF.Assets.Interaction; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NetAF.Logic; | ||
using NetAF.Commands.RegionMap; | ||
using NetAF.Logic.Modes; | ||
using NetAF.Assets.Characters; | ||
using NetAF.Assets.Locations; | ||
using NetAF.Utilities; | ||
using NetAF.Assets; | ||
|
||
namespace NetAF.Tests.Commands.RegionMap | ||
{ | ||
[TestClass] | ||
public class PanReset_Tests | ||
{ | ||
[TestMethod] | ||
public void GivenNullGame_WhenInvoke_ThenError() | ||
{ | ||
var command = new PanReset(); | ||
|
||
var result = command.Invoke(null); | ||
|
||
Assert.AreEqual(ReactionResult.Error, result.Result); | ||
} | ||
|
||
[TestMethod] | ||
public void GivenValidGame_WhenInvokeAndNotInRegionMapMode_ThenError() | ||
{ | ||
var game = Game.Create(new GameInfo(string.Empty, string.Empty, string.Empty), string.Empty, AssetGenerator.Retained(null, null), GameEndConditions.NoEnd, TestGameConfiguration.Default).Invoke(); | ||
var command = new PanReset(); | ||
|
||
var result = command.Invoke(game); | ||
|
||
Assert.AreEqual(ReactionResult.Error, result.Result); | ||
} | ||
|
||
[TestMethod] | ||
public void GivenValidGameAndCantResetPan_WhenInvokeAndInRegionMapMode_ThenSilent() | ||
{ | ||
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 GameInfo(string.Empty, string.Empty, string.Empty), string.Empty, AssetGenerator.Retained(overworldMaker.Make(), new PlayableCharacter(string.Empty, string.Empty)), GameEndConditions.NoEnd, TestGameConfiguration.Default).Invoke(); | ||
var command = new PanReset(); | ||
game.ChangeMode(new RegionMapMode(RegionMapMode.Player)); | ||
|
||
var result = command.Invoke(game); | ||
|
||
Assert.AreEqual(ReactionResult.Silent, result.Result); | ||
} | ||
|
||
[TestMethod] | ||
public void GivenValidGameAndCanPan_WhenInvokeAndInRegionMapMode_ThenSilent() | ||
{ | ||
RegionMaker regionMaker = new(string.Empty, string.Empty); | ||
Room room = new(string.Empty, string.Empty); | ||
Room room2 = new(string.Empty, string.Empty); | ||
regionMaker[0, 0, 0] = room; | ||
regionMaker[0, 0, 1] = room2; | ||
OverworldMaker overworldMaker = new(string.Empty, string.Empty, regionMaker); | ||
var game = Game.Create(new GameInfo(string.Empty, string.Empty, string.Empty), string.Empty, AssetGenerator.Retained(overworldMaker.Make(), new PlayableCharacter(string.Empty, string.Empty)), GameEndConditions.NoEnd, TestGameConfiguration.Default).Invoke(); | ||
game.Overworld.CurrentRegion.JumpToRoom(new Point3D(0, 0, 1)); | ||
var command = new PanReset(); | ||
game.ChangeMode(new RegionMapMode(RegionMapMode.Player)); | ||
|
||
var result = command.Invoke(game); | ||
|
||
Assert.AreEqual(ReactionResult.Silent, result.Result); | ||
} | ||
} | ||
} |
Oops, something went wrong.