Ejemplo n.º 1
0
        public void ShouldAddToMasterList()
        {
            var masterList = new SimpleClass[2];

            var obj1 = new SimpleClass();
            var obj2 = new SimpleClass();

            using (mocks.Record())
            {

                objectBuilder.Stub(x => x.BuilderSetup).Return(builderSetup);
                objectBuilder.Expect(x => x.Construct(0)).Return(obj1);
                objectBuilder.Expect(x => x.Construct(1)).Return(obj2);
            }

            using (mocks.Playback())
            {
                declaration = new GlobalDeclaration<SimpleClass>(listBuilderImpl, objectBuilder);

                declaration.Construct();
                declaration.AddToMaster(masterList);
            }

            Assert.That(masterList[0], Is.SameAs(obj1));
            Assert.That(masterList[1], Is.SameAs(obj2));
        }
Ejemplo n.º 2
0
        public void ShouldRecordMasterListKeys()
        {
            SimpleClass[] masterList = new SimpleClass[19];

            using (mocks.Record())
                objectBuilder.Expect(x => x.Construct(Arg<int>.Is.Anything)).Return(new SimpleClass()).Repeat.Times(2);

            declaration = new GlobalDeclaration<SimpleClass>(listBuilderImpl, objectBuilder);
            declaration.Construct();

            declaration.AddToMaster(masterList);

            Assert.That(declaration.MasterListAffectedIndexes.Count, Is.EqualTo(2));
            Assert.That(declaration.MasterListAffectedIndexes[0], Is.EqualTo(0));
            Assert.That(declaration.MasterListAffectedIndexes[1], Is.EqualTo(1));
        }
Ejemplo n.º 3
0
        public void DeclarationShouldAddToMasterListInCorrectPlace()
        {
            SimpleClass[] masterList = new SimpleClass[19];
            var obj1 = new SimpleClass();
            var obj2 = new SimpleClass();

            using (mocks.Record())
            {
                objectBuilder.Expect(x => x.Construct()).Return(obj1);
                objectBuilder.Expect(x => x.Construct()).Return(obj2);
            }

            declaration = new RangeDeclaration<SimpleClass>(listBuilderImpl, objectBuilder, 9, 10);
            declaration.Construct();
            declaration.AddToMaster(masterList);

            Assert.That(masterList[9], Is.SameAs(obj1));
            Assert.That(masterList[10], Is.SameAs(obj2));
        }
Ejemplo n.º 4
0
 public void Add(SimpleClass simpleClass)
 {
     SimpleClasses.Add(simpleClass);
 }
Ejemplo n.º 5
0
 public void Add(SimpleClass simpleClass)
 {
     SimpleClasses.Add(simpleClass);
 }