public void TheLastAmountMustBeOneOrGreater()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         ListBuilderExtensions.TheLast(listBuilderImpl, 0);
     });
 }
Exemple #2
0
        public void TheLastAmountShouldBeLessThanListCapacity()
        {
            using (mocks.Record())
                listBuilderImpl.Expect(x => x.Capacity).Return(10);

            ListBuilderExtensions.TheLast(listBuilderImpl, 11);
        }
        public void TheLastAmountShouldBeLessThanListCapacity()
        {
            listBuilderImpl.Capacity.Returns(10);

            Assert.Throws <ArgumentException>(() =>
            {
                ListBuilderExtensions.TheLast(listBuilderImpl, 11);
            });
        }
        public void TheLastAmountShouldBeLessThanListCapacity()
        {
            using (mocks.Record())
                listBuilderImpl.Expect(x => x.Capacity).Return(10);

            Assert.Throws <ArgumentException>(() =>
            {
                ListBuilderExtensions.TheLast(listBuilderImpl, 11);
            });
        }
        public void LastRangeShouldBeTheCapacityMinusTheRangeSizeAndOneLessThanTheCapacity()
        {
            const int rangeSize  = 10;
            const int startIndex = listSize - rangeSize; // 20
            const int endIndex   = listSize - 1;         // 29

            var rangeDeclaration = new RangeDeclaration <MyClass>(listBuilderImpl, null, 0, 0);


            listBuilderImpl.BuilderSettings.Returns(new BuilderSettings());
            listBuilderImpl.Capacity.Returns(listSize);
            listBuilderImpl.CreateObjectBuilder().Returns((IObjectBuilder <MyClass>)null);
            listBuilderImpl.AddDeclaration(Arg.Is <RangeDeclaration <MyClass> >(y => y.Start == startIndex && y.End == endIndex)).Returns(rangeDeclaration);

            var declaration = ListBuilderExtensions.TheLast(listBuilderImpl, 10);

            Assert.That(declaration, Is.SameAs(rangeDeclaration));
        }
Exemple #6
0
        public void LastRangeShouldBeTheCapacityMinusTheRangeSizeAndOneLessThanTheCapacity()
        {
            const int rangeSize  = 10;
            const int startIndex = listSize - rangeSize; // 20
            const int endIndex   = listSize - 1;         // 29

            var rangeDeclaration = new RangeDeclaration <MyClass>(listBuilderImpl, null, 0, 0);

            using (mocks.Record())
            {
                listBuilderImpl.Expect(x => x.Capacity).Return(listSize).Repeat.Times(3);
                listBuilderImpl.Expect(x => x.CreateObjectBuilder()).Return(null);
                listBuilderImpl.Expect(x => x.AddDeclaration(Arg <RangeDeclaration <MyClass> > .Matches(y => y.Start == startIndex && y.End == endIndex))).Return(rangeDeclaration);
            }

            using (mocks.Playback())
            {
                var declaration = ListBuilderExtensions.TheLast(listBuilderImpl, 10);
                Assert.That(declaration, Is.SameAs(rangeDeclaration));
            }
        }
Exemple #7
0
 public void TheLastAmountMustBeOneOrGreater()
 {
     ListBuilderExtensions.TheLast(listBuilderImpl, 0);
 }