コード例 #1
0
        public void TestThat_VotersPerIPAddress_SetsTheVotersObtainedFromTheDataProviderOnTheModel()
        {
            var voters       = new[] { new IPAddressVoterModel(), new IPAddressVoterModel() };
            var dataProvider = new DataProviderBuilder().WithVotersForIPAddresses(voters).Build();
            var controller   = new VotingControllerBuilder().WithDataProvider(dataProvider).Build();

            var model = controller.VotersPerIPAddress().GetViewModel <VotersPerIPAddressViewModel>();

            CollectionAssert.AreEquivalent(voters, model.IPAddressVoters);
        }
コード例 #2
0
        public void TestThat_VotersPerIPAddress_SetsTheHighestOccuringNumberOfVotersOnTheModel()
        {
            var voters = new[] { new IPAddressVoterModel {
                                     NumberOfVoters = 2
                                 }, new IPAddressVoterModel {
                                     NumberOfVoters = 4
                                 } };
            var dataProvider = new DataProviderBuilder().WithVotersForIPAddresses(voters).Build();
            var controller   = new VotingControllerBuilder().WithDataProvider(dataProvider).Build();

            var model = controller.VotersPerIPAddress().GetViewModel <VotersPerIPAddressViewModel>();

            Assert.That(model.HighestNumberOfVoters, Is.EqualTo(4));
        }