public void ShouldBeAbleToConstructItems() { using (mocks.Record()) { objectBuilder.Expect(x => x.Construct(Arg <int> .Is.Anything)).Return(new SimpleClass()).Repeat.Times(2); } using (mocks.Playback()) { declaration.Construct(); } }
public void ShouldAddToMasterList() { var masterList = new SimpleClass[2]; var obj1 = new SimpleClass(); var obj2 = new SimpleClass(); using (mocks.Record()) { objectBuilder.Stub(x => x.BuilderSettings).Return(builderSettings); 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)); }
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)); }
public void ShouldBeAbleToConstructItems() { objectBuilder.BuilderSettings.Returns(builderSettings); objectBuilder.Construct(Arg.Any <int>()).Returns(new SimpleClass()); declaration = new GlobalDeclaration <SimpleClass>(listBuilderImpl, objectBuilder); declaration.Construct(); }
public void ShouldConstructDeclarations() { IGlobalDeclaration <MyClass> declaration = Substitute.For <IGlobalDeclaration <MyClass> >(); var builder = new ListBuilder <MyClass>(listSize, propertyNamer, reflectionUtil, new BuilderSettings()); builder.AddDeclaration(declaration); declaration.Construct(); builder.Construct(); }
public void ShouldBeAbleToConstructItems() { using (mocks.Record()) { objectBuilder.Stub(x => x.BuilderSettings).Return(builderSettings); objectBuilder.Expect(x => x.Construct(Arg <int> .Is.Anything)).Return(new SimpleClass()).Repeat.Times(2); } using (mocks.Playback()) { declaration = new GlobalDeclaration <SimpleClass>(listBuilderImpl, objectBuilder); declaration.Construct(); } }
public void ShouldBeAbleToConstructItems() { using (mocks.Record()) { objectBuilder.Stub(x => x.BuilderSetup).Return(builderSetup); objectBuilder.Expect(x => x.Construct(Arg<int>.Is.Anything)).Return(new SimpleClass()).Repeat.Times(2); } using (mocks.Playback()) { declaration = new GlobalDeclaration<SimpleClass>(listBuilderImpl, objectBuilder); declaration.Construct(); } }
public void ShouldRecordMasterListKeys() { SimpleClass[] masterList = new SimpleClass[19]; objectBuilder.BuilderSettings.Returns(builderSettings); objectBuilder.Construct(Arg.Any <int>()).Returns(new SimpleClass()); declaration = new GlobalDeclaration <SimpleClass>(listBuilderImpl, objectBuilder); declaration.Construct(); declaration.AddToMaster(masterList); declaration.MasterListAffectedIndexes.Count.ShouldBe(2); declaration.MasterListAffectedIndexes[0].ShouldBe(0); declaration.MasterListAffectedIndexes[1].ShouldBe(1); }
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)); }
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)); }
public void ShouldAddToMasterList() { var masterList = new SimpleClass[2]; var obj1 = new SimpleClass(); var obj2 = new SimpleClass(); objectBuilder.BuilderSettings.Returns(builderSettings); objectBuilder.Construct(0).Returns(obj1); objectBuilder.Construct(1).Returns(obj2); declaration = new GlobalDeclaration <SimpleClass>(listBuilderImpl, objectBuilder); declaration.Construct(); declaration.AddToMaster(masterList); masterList[0].ShouldBeSameAs(obj1); masterList[1].ShouldBeSameAs(obj2); }