public async Task GetDistro_WhenInvoked_LogsMethodInvoked()
        {
            var foldingUsers = new FoldingUser[0];

            statsDownloadApiDataStoreServiceMock.GetFoldingMembers(startDateMock, endDateMock).Returns(foldingUsers);

            await systemUnderTest.GetDistro(startDateMock, endDateMock, amountMock);

            Received.InOrder(() =>
            {
                loggingServiceMock.LogMethodInvoked(nameof(systemUnderTest.GetDistro));
                statsDownloadApiTokenDistributionServiceMock.GetDistro(amountMock, foldingUsers);
                loggingServiceMock.LogMethodFinished(nameof(systemUnderTest.GetDistro));
            });
        }
        public void GetDistro_WhenInvoked_CombinesDistroUsersByAddress()
        {
            IList <DistroUser> actual = systemUnderTest.GetDistro(1,
                                                                  new[]
            {
                new FoldingUser("friendlyName1", "address1", 1, 2),
                new FoldingUser("friendlyName2", "address2", 98, 96),
                new FoldingUser("friendlyName1", "address1", 1, 2)
            });

            Assert.That(actual.Count, Is.EqualTo(2));
            Assert.That(actual[0].BitcoinAddress, Is.EqualTo("address2"));
            Assert.That(actual[0].PointsGained, Is.EqualTo(98));
            Assert.That(actual[0].WorkUnitsGained, Is.EqualTo(96));
            Assert.That(actual[0].Amount, Is.EqualTo(0.98));
            Assert.That(actual[1].BitcoinAddress, Is.EqualTo("address1"));
            Assert.That(actual[1].PointsGained, Is.EqualTo(2));
            Assert.That(actual[1].WorkUnitsGained, Is.EqualTo(4));
            Assert.That(actual[1].Amount, Is.EqualTo(0.02));
        }
 private GetDistroResponse GetDistro(int?amount, IList <FoldingUser> foldingUsers)
 {
     try
     {
         IList <DistroUser> distro =
             statsDownloadApiTokenDistributionService.GetDistro(amount.GetValueOrDefault(), foldingUsers);
         return(new GetDistroResponse(distro));
     }
     catch (InvalidDistributionState invalidDistributionState)
     {
         return(new GetDistroResponse(new List <ApiError>
         {
             new ApiError(ApiErrorCode.InvalidDistributionState,
                          invalidDistributionState.Message)
         }));
     }
 }