public void CreatesOneUp_WhenModeSetToOneUp(Mode mode, TurnType type) { var match = MatchMockCreator.CreateSettingsWithHost(mode, type) .CreateMatch(); Assert.Equal(mode, match.Mode); }
public void ThrowsHostingLimitReachedException_WhenHostingLimitReached() { var settings = MatchMockCreator.CreateSettingsWithHost(); settings.Host.Hosting = 1; Assert.Equal(settings.Host.Hosting, settings.Host.HostingLimit); Assert.Throws <HostingLimitReachedException>(() => settings.CreateMatch()); }
public void Match_HasOnlyHostUserWithId_WhenCreated() { var match = MatchMockCreator.CreateSettingsWithHost() .CreateMatch(); Assert.True(match.MatchUsers.Count == 1); Assert.Contains(match.MatchUsers, x => x.Role == MatchRole.Host && !string.IsNullOrEmpty(x.UserId)); }
public void CreatesMatch_WithSelectedSurface(Surface surface) { var settings = MatchMockCreator.CreateSettingsWithHost(); settings.Surface = surface; var match = settings.CreateMatch(); Assert.Equal(surface, match.Surface); }
public void UserJoinCountIncremented_WhenJoinedMatch() { Assert.True(_opponent.Joined == 0); var settings = MatchMockCreator.CreateSettingsWithHost(); var match = settings.CreateMatch(); var manager = new MatchDoorman(_opponentCheckerMock.Object); manager.AddOpponent(match, _opponent); Assert.Equal(1, _opponent.Joined); }
public void InformationAsExpected_WhenModeIsThreeRoundPass_AndTurnTypeIsBlitz() { var settings = MatchMockCreator.CreateSettingsWithHost(Mode.ThreeRoundPass); settings.TurnType = TurnType.Blitz; 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.True(match.GetOpponent().CanGo); Assert.Equal("", match.Turn); }
public void ThrowsCantJoinMatchException_WhenMatchNotOpenOrInvitation() { var settings = MatchMockCreator.CreateSettingsWithHost(); var match = settings.CreateMatch(); var failMatchStates = new[] { Status.Active, Status.Closed, Status.Complete, Status.Pending, }; foreach (var status in failMatchStates) { match.Status = status; var doorman = new MatchDoorman(_opponentCheckerMock.Object); Assert.Throws <CantJoinMatchException>(() => doorman.AddOpponent(match, _opponent)); } }