コード例 #1
0
        public async Task BetService_GetByIdWithDetails_ReturnsProperBet()
        {
            var expected       = GetTestBetsModels().First();
            var mockUnitOfWork = new Mock <IUnitOfWork>();

            mockUnitOfWork
            .Setup(m => m.BetRepository.GetByIdWithDetailsAsync(It.IsAny <int>()))
            .ReturnsAsync(GetTestBets().First());
            var betService = new BetService(mockUnitOfWork.Object, UnitTestHelper.CreateMapperProfile());

            var actual = await betService.GetByIdAsync(expected.Id);

            Assert.AreEqual(expected.Id, actual.Id);
            Assert.AreEqual(expected.Sum, actual.Sum);
            Assert.AreEqual(expected.BetDate.Date, actual.BetDate.Date);
        }