コード例 #1
0
        public void TestThat_NumberOfUsersWhoHaveCastXVotes_PassesTheCorrectChartDataToTheView()
        {
            long[][] chartData          = new long[2][];
            var      chartDataConverter = new ChartDataConverterBuilder().WithChartDataPerUser(chartData).Build();
            var      controller         = new VotingControllerBuilder().WithChartDataConverter(chartDataConverter).Build();

            var model = controller.NumberOfUsersWhoHaveCastXVotes().GetViewModel <long[][]>();

            CollectionAssert.AreEquivalent(chartData, model);
        }
コード例 #2
0
        public void TestThat_VotesPerDate_PassesTheCorrectChartDataToTheView()
        {
            long[][] chartData          = new long[2][];
            var      chartDataConverter = new ChartDataConverterBuilder().WithChartDataPerDate(chartData).Build();
            var      controller         = new VotingControllerBuilder().WithChartDataConverter(chartDataConverter).Build();

            var model = controller.VotesPerDate().GetViewModel <VotesPerDateViewModel>();

            CollectionAssert.AreEquivalent(chartData, model.DayByDay);
            CollectionAssert.AreEquivalent(chartData, model.Cumulative);
        }
コード例 #3
0
        public void TestThat_NumberOfUsersWhoHaveCastXVotes_UsesTheDataObtainedFromTheDataProvider_ToCreateTheChartData()
        {
            var voteCounts         = new[] { new NumberOfUsersWithVotesModel() };
            var dataProvider       = new DataProviderBuilder().WithNumberOfVotesCastCounts(voteCounts).Build();
            var chartDataConverter = new ChartDataConverterBuilder().Build();
            var controller         = new VotingControllerBuilder().WithDataProvider(dataProvider)
                                     .WithChartDataConverter(chartDataConverter)
                                     .Build();

            controller.NumberOfUsersWhoHaveCastXVotes();

            chartDataConverter.Received().ToChartData(voteCounts);
        }
コード例 #4
0
        public void TestThat_VotesPerHour_UsesTheDataObtainedFromTheDataProvider_ToCreateTheChartData()
        {
            var votes              = new[] { new DateTimeVoteModel() };
            var dataProvider       = new DataProviderBuilder().WithVotesPerHour(votes).Build();
            var chartDataConverter = new ChartDataConverterBuilder().Build();
            var controller         = new VotingControllerBuilder()
                                     .WithDataProvider(dataProvider)
                                     .WithChartDataConverter(chartDataConverter)
                                     .Build();

            controller.VotesPerHour();

            chartDataConverter.Received().ToChartData(votes, Arg.Any <Func <DateTimeVoteModel, long> >());
        }
コード例 #5
0
        public void TestThat_VotesPerDay_UsesTheDataObtainedFromTheDataProvider_ToCreateTheChartData()
        {
            var votes              = new[] { new DayOfWeekVoteModel() };
            var dataProvider       = new DataProviderBuilder().WithVotesPerDay(votes).Build();
            var chartDataConverter = new ChartDataConverterBuilder().Build();
            var controller         = new VotingControllerBuilder()
                                     .WithDataProvider(dataProvider)
                                     .WithChartDataConverter(chartDataConverter)
                                     .Build();

            controller.VotesPerDay();

            chartDataConverter.Received().ToChartData(votes);
        }