Esempio n. 1
0
        public void ShouldNotRound()
        {
            var data = new List <Tuple <string, decimal> >()
            {
                Tuple.Create("a", 25m),
                Tuple.Create("b", 25m),
                Tuple.Create("c", 25m),
                Tuple.Create("d", 25m),
            };

            var rounded = Rounder.round(data);

            rounded.First().Item1.Should().Be("a");
            rounded.ElementAt(1).Item1.Should().Be("b");
            rounded.ElementAt(2).Item1.Should().Be("c");
            rounded.ElementAt(3).Item1.Should().Be("d");

            rounded.First().Item2.Should().Be(25);
            rounded.ElementAt(1).Item2.Should().Be(25);
            rounded.ElementAt(2).Item2.Should().Be(25);
            rounded.ElementAt(3).Item2.Should().Be(25);
        }
Esempio n. 2
0
        public void ShouldRoundTwoItems()
        {
            var data = new List <Tuple <string, decimal> >()
            {
                Tuple.Create("a", 25.6m),
                Tuple.Create("b", 25.6m),
                Tuple.Create("c", 24.4m),
                Tuple.Create("d", 24.4m),
            };

            var rounded = Rounder.round(data);

            rounded.Sum(a => a.Item2).Should().Be(100);

            rounded.First().Item1.Should().Be("a");
            rounded.ElementAt(1).Item1.Should().Be("b");
            rounded.ElementAt(2).Item1.Should().Be("c");
            rounded.ElementAt(3).Item1.Should().Be("d");

            rounded.First().Item2.Should().Be(26);
            rounded.ElementAt(1).Item2.Should().Be(26);
            rounded.ElementAt(2).Item2.Should().Be(24);
            rounded.ElementAt(3).Item2.Should().Be(24);
        }
Esempio n. 3
0
        public void ShouldRoundSome()
        {
            var data = new List <Tuple <string, decimal> >()
            {
                Tuple.Create("Equities", 31.6220989654932m),
                Tuple.Create("Fixed Income", 55.8340786306896m),
                Tuple.Create("Alternatives", 2.88033373820556m),
                Tuple.Create("Cash", 9.66349214560435m),
            };

            var rounded = Rounder.round(data);

            rounded.Sum(a => a.Item2).Should().Be(100);

            rounded.First().Item1.Should().Be("Equities");
            rounded.ElementAt(1).Item1.Should().Be("Fixed Income");
            rounded.ElementAt(2).Item1.Should().Be("Alternatives");
            rounded.ElementAt(3).Item1.Should().Be("Cash");

            rounded.First().Item2.Should().Be(31);
            rounded.ElementAt(1).Item2.Should().Be(56);
            rounded.ElementAt(2).Item2.Should().Be(3);
            rounded.ElementAt(3).Item2.Should().Be(10);
        }