Пример #1
0
        public async Task WhenGettingCreatorRevenues_ItShouldIssueGetGetAllCreatorRevenuesQuery()
        {
            this.requesterContext.Setup(_ => _.GetRequesterAsync()).ReturnsAsync(Requester);

            var expectedResult = new GetAllCreatorRevenuesResult(new List <GetAllCreatorRevenuesResult.Creator>());

            this.getAllCreatorRevenues.Setup(v => v.HandleAsync(new GetAllCreatorRevenuesQuery(Requester)))
            .Returns(Task.FromResult(expectedResult)).Verifiable();

            var result = await this.target.GetCreatorRevenues();

            Assert.AreEqual(expectedResult, result);
            this.getAllCreatorRevenues.Verify();
        }
        public async Task ItShouldReturnCreatorRevenues()
        {
            this.timestampCreator.Setup(v => v.Now()).Returns(Now);

            var expectedResult = new GetAllCreatorRevenuesResult(new List <GetAllCreatorRevenuesResult.Creator>
            {
                new GetAllCreatorRevenuesResult.Creator(UserId.Random(), 1, 2, 3, new Username("username"), new Email("*****@*****.**"), true),
                new GetAllCreatorRevenuesResult.Creator(UserId.Random(), 4, 5, 6, new Username("username2"), new Email("*****@*****.**"), false),
            });

            this.getAllCreatorRevenuesDbStatement.Setup(v => v.ExecuteAsync(ReleasableRevenueDate))
            .ReturnsAsync(expectedResult);

            var result = await this.target.HandleAsync(Query);

            Assert.AreEqual(expectedResult, result);
        }