示例#1
0
        public async Task EditGetTest()
        {
            ClubService ClubService = CreateClubService();

            var result = await ClubService.EditAsync(GetIdForSearch);

            Assert.NotNull(result);
            Assert.IsType <ClubProfileDTO>(result);
        }
示例#2
0
        public async Task EditAsync_ReturnsClubEdited()
        {
            // Arrange
            ClubService clubService = CreateClubService();

            // Act
            var result = await clubService.EditAsync(Id);

            // Assert
            Assert.NotNull(result);
            Assert.IsInstanceOf <ClubProfileDTO>(result);
        }
示例#3
0
        public async Task EditAsync_ReturnNull()
        {
            // Arrange
            ClubService clubService = CreateClubService();

            _mapper.Setup(m => m.Map <DataAccessClub.Club, ClubDTO>(It.IsAny <DataAccessClub.Club>()))
            .Returns(new List <ClubDTO>().FirstOrDefault());

            // Act
            var result = await clubService.EditAsync(Id);

            // Assert
            Assert.Null(result);
        }
示例#4
0
        public async Task EditAsync_WhereMembersIsNull_ReturnsClubEdited()
        {
            // Arrange
            ClubService clubService = CreateClubService();

            _mapper.Setup(m => m.Map <DataAccessClub.Club, ClubDTO>(It.IsAny <DataAccessClub.Club>()))
            .Returns(CreateFakeClubDtoWithoutMembersWithoutAdminEndDate(count).FirstOrDefault());

            // Act
            var result = await clubService.EditAsync(Id);

            // Assert
            Assert.NotNull(result);
            Assert.IsInstanceOf <ClubProfileDTO>(result);
            Assert.AreEqual(new List <ClubMembersDTO>(), result.Members);
        }
示例#5
0
        public async Task EditAsync_WithModel_ReturnsClubEdited()
        {
            // Arrange
            ClubService clubService = CreateClubService();
            ClubDTO     clubDto     = new ClubDTO
            {
                ID = 0
            };

            _repoWrapper.Setup(r => r.Club.Attach(It.IsAny <DataAccessClub.Club>()));
            _repoWrapper.Setup(r => r.Club.Update(It.IsAny <DataAccessClub.Club>()));
            _repoWrapper.Setup(r => r.SaveAsync());

            // Act
            await clubService.EditAsync(clubDto);

            // Assert
            _repoWrapper.Verify(r => r.Club.Attach(It.IsAny <DataAccessClub.Club>()), Times.Once);
            _repoWrapper.Verify(r => r.Club.Update(It.IsAny <DataAccessClub.Club>()), Times.Once);
            _repoWrapper.Verify(r => r.SaveAsync(), Times.Once);
        }