コード例 #1
0
        public async Task FetchInvitationsAsync_WithUserId_ShouldBeOfTypeInvitationList()
        {
            // Arrange
            var userId = new UserId();

            TestMock.InvitationRepository.Setup(repository => repository.FetchAsync(It.IsAny <UserId>()))
            .ReturnsAsync(
                new List <Invitation>
            {
                new Invitation(userId, new ClanId()),
                new Invitation(userId, new ClanId()),
                new Invitation(userId, new ClanId())
            })
            .Verifiable();

            var service = new InvitationService(TestMock.InvitationRepository.Object, TestMock.ClanRepository.Object);

            // Act
            var result = await service.FetchInvitationsAsync(new UserId());

            // Assert
            result.Should().BeOfType <List <Invitation> >();

            TestMock.InvitationRepository.Verify(repository => repository.FetchAsync(It.IsAny <UserId>()), Times.Once);
        }