コード例 #1
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);
        }
コード例 #2
0
        public void TestThat_VotesPerDate_UsesTheDataObtainedFromTheDataProvider_ToCreateTheChartData()
        {
            var votes              = new[] { new DateTimeVoteModel() };
            var dataProvider       = new DataProviderBuilder().WithVotesPerDate(votes).Build();
            var chartDataConverter = new ChartDataConverterBuilder().Build();
            var controller         = new VotingControllerBuilder()
                                     .WithDataProvider(dataProvider)
                                     .WithChartDataConverter(chartDataConverter)
                                     .Build();

            controller.VotesPerDate();

            chartDataConverter.Received().ToChartData(votes, Arg.Any <Func <DateTimeVoteModel, long> >());
        }