当前位置: 首页>>代码示例>>C#>>正文


C# Game.Join方法代码示例

本文整理汇总了C#中Game.Join方法的典型用法代码示例。如果您正苦于以下问题:C# Game.Join方法的具体用法?C# Game.Join怎么用?C# Game.Join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game的用法示例。


在下文中一共展示了Game.Join方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ThrowWhenGameStarted

 public void ThrowWhenGameStarted()
 {
     var game = new Game();
     game.Join(PlayerMother.GeneratePlayer());
     game.Join(PlayerMother.GeneratePlayer());
     game.Start();
     Assert.Throws<InvalidGameStateException>(() => game.Join(PlayerMother.GeneratePlayer()));
 }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:8,代码来源:GameJoinShould.cs

示例2: ThrowWhenGameCompleted

        public void ThrowWhenGameCompleted()
        {
            var game = new Game();
            var players = PlayerMother.GeneratePlayers(2);

            foreach (var player in players)
                game.Join(player);

            game.Start();

            foreach (var player in players)
                game.Move(player, Moves.Paper);

            Assert.Throws<InvalidGameStateException>(() => game.Join(PlayerMother.GeneratePlayer()));
        }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:15,代码来源:GameJoinShould.cs

示例3: AddPlayerToCollection

        public void AddPlayerToCollection()
        {
            //Arrange
            var game = new Game();
            PlayerRef player = PlayerMother.GeneratePlayer();

            //Act
            game.Join(player);

            //Assert
            game.Players.Should().Contain(player);
        }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:12,代码来源:GameJoinShould.cs

示例4: GenerateStartedGame

        public static Game GenerateStartedGame(int numberOfPlayers = 2)
        {
            var game = new Game()
            {
                Id = Random.Next()
            };

            var players = PlayerMother.GeneratePlayers(numberOfPlayers);
            foreach (var player in players)
                game.Join(player);
            game.Start();

            DomainEvents.GetEvents().ToArray();

            return game;
        }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:16,代码来源:GameMother.cs

示例5: PublishPlayerJoined

        public void PublishPlayerJoined()
        {
            //Arrange
            var game = new Game();
            PlayerRef player = PlayerMother.GeneratePlayer();

            //Act
            game.Join(player);

            //Assert
            var e = DomainEvents.GetEvents().Single();
            e.Should().Be.OfType<PlayerJoined>();
            var pje = (PlayerJoined) e;
            pje.PlayerId.Should().Be.EqualTo(player.PlayerId);
            pje.GameId.Should().Be.EqualTo(game.Id);
        }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:16,代码来源:GameJoinShould.cs

示例6: ThrowOnNullPlayer

 public void ThrowOnNullPlayer()
 {
     var game = new Game();
     Assert.Throws<ArgumentNullException>(() => game.Join(null));
 }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:5,代码来源:GameJoinShould.cs

示例7: ThrowWhenGameNotStarted

        public void ThrowWhenGameNotStarted()
        {
            var game = new Game();
            var players = PlayerMother.GeneratePlayers(2).ToArray();

            foreach (var player in players)
                game.Join(player);

            Assert.Throws<InvalidGameStateException>(() => game.Move(players.First(), Moves.Paper));
        }
开发者ID:jasondentler,项目名称:RockPaperScissors,代码行数:10,代码来源:GameMoveShould.cs


注:本文中的Game.Join方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。