コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: karl45/project1
        public async Task GetPlayerTest()
        {
            int Playerid = 1;
            var Player   = new Player()
            {
                PlayerId = Playerid
            };

            var fakeRepositoryMock = new Mock <IPlayerRepository>();

            fakeRepositoryMock.Setup(x => x.GetPlayer(Playerid)).ReturnsAsync(Player);

            var PlayerService = new PlayerServices(fakeRepositoryMock.Object);

            var resultPlayer = await PlayerService.GetPlayer(Playerid);

            Assert.Equal(Playerid, resultPlayer.PlayerId);
        }