public void NotVisibleWhenPossibleCommandsListIsEmpty() { var stubCommandConsole = MockRepository.GenerateStub<ICommandConsole>(); stubCommandConsole.Active = true; Log<string> possibleCommands = new Log<string>(); stubCommandConsole.Stub(me => me.FindPossibleInputCompletions(Arg<string>.Is.Anything)).Return(possibleCommands); PossibleCommandsLogHudView hudView = new PossibleCommandsLogHudView(new InputLine(), stubCommandConsole, rectangle, stubFont, Color.Blue); Assert.IsFalse(hudView.Visible); }
public void DrawsPossibleCommandCompletions() { var stubCommandConsole = MockRepository.GenerateStub<ICommandConsole>(); Log<string> possibleCommands = new Log<string>() { "Hey", "Yo" }; stubCommandConsole.Stub(x => x.FindPossibleInputCompletions(Arg<string>.Is.Anything)).Return(possibleCommands); PossibleCommandsLogHudView hudView = new PossibleCommandsLogHudView(new InputLine(), stubCommandConsole, rectangle, stubFont, Color.Blue); Rectangle possibleCommandsWindow = hudView.Window; hudView.Draw(stubSpriteBatch); stubSpriteBatch.AssertWasCalled(x => x.DrawText(Arg<IFont>.Is.Equal(stubFont), Arg<string>.Is.Equal("Hey"), Arg<Vector2>.Is.Equal(new Vector2(possibleCommandsWindow.Left + OverlaySetView.TEXT_OFFSET.Y, possibleCommandsWindow.Bottom - OverlaySetView.TEXT_OFFSET.Y - (2 * stubFont.LineSpacing))), Arg<Color>.Is.Equal(Color.Blue), Arg<float>.Is.Anything)); stubSpriteBatch.AssertWasCalled(x => x.DrawText(Arg<IFont>.Is.Equal(stubFont), Arg<string>.Is.Equal("Yo"), Arg<Vector2>.Is.Equal(new Vector2(possibleCommandsWindow.Left + OverlaySetView.TEXT_OFFSET.Y, possibleCommandsWindow.Bottom - OverlaySetView.TEXT_OFFSET.Y - stubFont.LineSpacing)), Arg<Color>.Is.Equal(Color.Blue), Arg<float>.Is.Anything)); }
public void ReturnsCorrectPossibleCommandsWindowSize() { var stubCommandConsole = MockRepository.GenerateStub<ICommandConsole>(); Log<string> possibleCommands = new Log<string>() { "1", "2", "3" }; stubCommandConsole.Stub(me => me.FindPossibleInputCompletions(Arg<string>.Is.Anything)).Return(possibleCommands); PossibleCommandsLogHudView hudView = new PossibleCommandsLogHudView(new InputLine(), stubCommandConsole, rectangle, stubFont, Color.Blue); Assert.AreEqual(rectangle.Width, hudView.Window.Width); Assert.AreEqual((int)(2 * OverlaySetView.TEXT_OFFSET.Y + (3 * stubFont.LineSpacing)), hudView.Window.Height); }