Example #1
0
        public async Task GetByIdTest()
        {
            ClubService ClubService = CreateClubService();

            var result = await ClubService.GetByIdAsync(GetIdForSearch);

            Assert.NotNull(result);
            Assert.IsType <ClubDTO>(result);
        }
        public async Task GetByIdAsync_WhenCalled_GetClubFromDb()
        {
            const int id           = 1;
            var       expectedClub = new Club
            {
                Id = id
            };

            _clubRepository.Setup(c => c.GetAsync(id)).ReturnsAsync(expectedClub);

            var result = await _clubService.GetByIdAsync(id);

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo(expectedClub));
        }
Example #3
0
        public async Task GetByIdAsync_ReturnsClub()
        {
            // Arrange
            _repoWrapper
            .Setup(r => r.Club.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <DataAccessClub.Club, bool> > >(), null))
            .ReturnsAsync(new DataAccessClub.Club());
            _mapper
            .Setup(m => m.Map <DataAccessClub.Club, ClubDTO>(It.IsAny <DataAccessClub.Club>()))
            .Returns(new ClubDTO());

            // Act
            var result = await _clubService.GetByIdAsync(Id);

            // Assert
            Assert.NotNull(result);
            Assert.IsInstanceOf <ClubDTO>(result);
        }