public void ThrowsCantJoinMatchException_WhenTryingToJoinYourOwnMatch() { var settings = MatchMockCreator.CreateSettings(); settings.Host = _host; var match = settings.CreateMatch(); var manager = new MatchDoorman(_opponentCheckerMock.Object); Assert.Throws <CantJoinMatchException>(() => { manager.AddOpponent(match, _host); }); }
public void ThrowsCantJoinMatchException_WhenAlreadyBattlingOpponent() { var settings = MatchMockCreator.CreateSettings(); settings.Host = _host; var match = settings.CreateMatch(); var checker = OpponentCheckerMock.Create(_host.Id, _opponent.Id, true); var manager = new MatchDoorman(checker.Object); Assert.Throws <CantJoinMatchException>(() => { manager.AddOpponent(match, _opponent); }); }
public void ThrowsCantJoinMatchException_WhenJoinLimitReached() { var settings = MatchMockCreator.CreateSettings(); settings.Host = _host; var match = settings.CreateMatch(); var manager = new MatchDoorman(_opponentCheckerMock.Object); _opponent.Joined = 1; Assert.Throws <CantJoinMatchException>(() => { manager.AddOpponent(match, _opponent); }); }
public void IncrementsHostingCount_ForHost_WhenMatchCreated() { var host = UserMockCreator.CreateHost(); var settings = MatchMockCreator.CreateSettings(); settings.Host = host; Assert.Equal(0, host.Hosting); settings.CreateMatch(); Assert.Equal(1, host.Hosting); }
public void UserCanJoinMatch_WithRoleOpponent() { var settings = MatchMockCreator.CreateSettings(); settings.Host = _host; var match = settings.CreateMatch(); var manager = new MatchDoorman(_opponentCheckerMock.Object); manager.AddOpponent(match, _opponent); Assert.Contains(match.MatchUsers, x => x.UserId == _opponent.Id && x.Role == MatchRole.Opponent); }
public void InformationAsExpected_WhenModeIsCopyCat() { var settings = MatchMockCreator.CreateSettings(Mode.CopyCat); settings.Host = _host; var match = settings.CreateMatch(); var manager = new MatchDoorman(_opponentCheckerMock.Object); manager.AddOpponent(match, _opponent); Assert.Equal(Status.Active, match.Status); Assert.True(match.GetHost().CanGo); Assert.False(match.GetOpponent().CanGo); Assert.Equal(_host.DisplayName, match.Turn); }
public void ThrowsUserNotFoundExceptionWhen_HostIsNull() { Assert.Throws <UserNotFoundException>(() => MatchMockCreator.CreateSettings().CreateMatch()); }