public void WorldUpdatesAutoupdateables() { var tmxStream = FileStreams.SmallTmx(); var tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream()); TmxSerializer serializer = new TmxSerializer(); Map map = serializer.Deserialize(tmxStream); TestingToyWorld toyWorld = new TestingToyWorld(map, tilesetTableStreamReader); toyWorld.SetRegister(new AutoupdateRegister()); Mock <IAutoupdateableGameActor> mock1 = new Mock <IAutoupdateableGameActor>(); Mock <IAutoupdateableGameActor> mock2 = new Mock <IAutoupdateableGameActor>(); toyWorld.AutoupdateRegister.Register(mock1.Object, 1); toyWorld.AutoupdateRegister.Register(mock2.Object, 2); // Act toyWorld.Update(); // Assert mock1.Verify(x => x.Update(It.IsAny <Atlas>(), It.IsAny <TilesetTable>())); mock2.Verify(x => x.Update(It.IsAny <Atlas>(), It.IsAny <TilesetTable>()), Times.Never()); // Act toyWorld.Update(); // Assert mock2.Verify(x => x.Update(It.IsAny <Atlas>(), It.IsAny <TilesetTable>())); }
public void WorldWithNullTilesetThrows() { Stream tmxStream = FileStreams.SmallTmx(); TmxSerializer serializer = new TmxSerializer(); Map map = serializer.Deserialize(tmxStream); Assert.Throws <ArgumentNullException>(() => new ToyWorld(map, null)); }
public ToyWorldTests() { Stream tmxStream = FileStreams.SmallTmx(); StreamReader tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream()); TmxSerializer serializer = new TmxSerializer(); Map map = serializer.Deserialize(tmxStream); m_world = new ToyWorld(map, tilesetTableStreamReader); }
public GameControllerTestBase() { var tmxMemoryStream = FileStreams.SmallTmx(); var tilesetTableMemoryStream = FileStreams.TilesetTableStream(); var tilesetTableStreamReader = new StreamReader(tilesetTableMemoryStream); var gameSetup = new GameSetup(tmxMemoryStream, tilesetTableStreamReader); GameController = GetController(gameSetup); GameController.Init(); }
public MapLoaderTests() { // initiate streamReaders var tmxMemoryStream = FileStreams.SmallTmx(); var tilesetTableMemoryStream = FileStreams.TilesetTableStream(); var tilesetTableStreamReader = new StreamReader(tilesetTableMemoryStream); var serializer = new TmxSerializer(); Map map = serializer.Deserialize(tmxMemoryStream); var tilesetTable = new TilesetTable(map, tilesetTableStreamReader); // create atlas m_atlas = MapLoader.LoadMap(map, tilesetTable, (GameActor actor) => { }); }