예제 #1
0
        public async Task 団体が存在しない場合例外()
        {
            // Arrange
            var teamRepository = new Mock <ITeamRepository>();

            teamRepository.Setup(r => r.FindByCodeAsync(new TeamCode("S00001")))
            .ReturnsAsync(default(Team))
            .Verifiable();
            var confirmationMailAddressRepository = new Mock <IAuthorizationLinkRepository>();
            var requestTeamRepository             = new Mock <IRequestTeamRepository>();
            var reservationNumberRepository       = new Mock <IReservationNumberRepository>();
            var seasonRepository = new Mock <ISeasonRepository>();
            var mailSender       = new Mock <IMailSender>();
            var usecase          = new TeamUseCase(
                teamRepository.Object,
                confirmationMailAddressRepository.Object,
                requestTeamRepository.Object,
                reservationNumberRepository.Object,
                seasonRepository.Object, mailSender.Object);

            // Act & Assert
            await Assert.ThrowsAsync <NotFoundException>(
                () => usecase.GetTeam("S00001"));

            teamRepository.Verify();
            teamRepository.VerifyNoOtherCalls();
        }
예제 #2
0
        public async Task 団体を取得()
        {
            // Arrange
            var team = new Team(
                teamCode: new TeamCode("S00001"),
                teamType: TeamType.School,
                teamName: new TeamName("大成ネット学園"),
                teamAbbreviatedName: new TeamAbbreviatedName("大成ネット学園"),
                representativeName: "山村修治",
                representativeEmailAddress: "*****@*****.**",
                telephoneNumber: "03-5408-8576",
                address: "大阪市西区京町堀2-13-1-211",
                coachName: "横溝学",
                coachEmailAddress: "*****@*****.**",
                teamJpin: "OS12345");
            var teamRepository = new Mock <ITeamRepository>();

            teamRepository.Setup(r => r.FindByCodeAsync(new TeamCode("S00001")))
            .ReturnsAsync(team)
            .Verifiable();
            var confirmationMailAddressRepository = new Mock <IAuthorizationLinkRepository>();
            var requestTeamRepository             = new Mock <IRequestTeamRepository>();
            var reservationNumberRepository       = new Mock <IReservationNumberRepository>();
            var seasonRepository = new Mock <ISeasonRepository>();
            var mailSender       = new Mock <IMailSender>();
            var usecase          = new TeamUseCase(
                teamRepository.Object,
                confirmationMailAddressRepository.Object,
                requestTeamRepository.Object,
                reservationNumberRepository.Object,
                seasonRepository.Object, mailSender.Object);

            // Act
            var act = await usecase.GetTeam("S00001");

            // Assert
            teamRepository.Verify();
            teamRepository.VerifyNoOtherCalls();
        }