public void ShouldAddChildren() { using (mocks.Record()) { sourceList.Expect(x => x.Count).Return(categoryCount).Repeat.Any(); randomGenerator.Expect(x => x.Next(minCategories, maxCategories)).Return(1).Repeat.Times(12); sourceList.Expect(x => x[0]).Return(new MyHierarchicalClass()).Repeat.Any(); sourceList.Expect(x => x.RemoveAt(0)).Repeat.Any(); } using (mocks.Playback()) { hierarchyGenerator = new HierarchyGenerator <MyHierarchicalClass>(sourceList, (x, y) => x.AddChild(y), numberOfRoots, depth, minCategories, maxCategories, randomGenerator, namingMethod, null); hierarchyGenerator.Generate(); } }
public void SetUp() { mocks = new MockRepository(); generator = MockRepository.GenerateStub<IRandomGenerator>(); reflectionUtil = MockRepository.GenerateStub<IReflectionUtil>(); reflectionUtil.Stub(x => x.IsDefaultValue(null)).IgnoreArguments().Return(true).Repeat.Any(); theList = new List<MyClass>(); for (int i = 0; i < listSize; i++) theList.Add(new MyClass()); // The lorem ipsum string generator does this to get a random length of the string generator.Expect(x => x.Next(1, 10)).Return(5).Repeat.Any(); new RandomValuePropertyNamer(generator, reflectionUtil, false, DateTime.MinValue, DateTime.MaxValue, true,new BuilderSetup()).SetValuesOfAllIn(theList); }
public void SetUp() { mocks = new MockRepository(); generator = MockRepository.GenerateStub <IRandomGenerator>(); reflectionUtil = MockRepository.GenerateStub <IReflectionUtil>(); reflectionUtil.Stub(x => x.IsDefaultValue(null)).IgnoreArguments().Return(true).Repeat.Any(); theList = new List <MyClass>(); for (int i = 0; i < listSize; i++) { theList.Add(new MyClass()); } // The lorem ipsum string generator does this to get a random length of the string generator.Expect(x => x.Next(1, 10)).Return(5).Repeat.Any(); new RandomValuePropertyNamer(generator, reflectionUtil, false, DateTime.MinValue, DateTime.MaxValue, true, new BuilderSetup()).SetValuesOfAllIn(theList); }
public void SetUp() { builderSettings = new BuilderSettings(); mocks = new MockRepository(); randomGenerator = mocks.DynamicMock<IRandomGenerator>(); target = new ExtensibleRandomValuePropertyNamer(randomGenerator, builderSettings); bool @bool = true; byte @byte = 1; char @char = 'a'; var dateTime = new DateTime(2009, 01, 01); decimal @decimal = 1m; double @double = 1d; float @float = 1f; Guid guid = new Guid(); int @int = 2; long @long = 3; string phrase = "some text"; sbyte @sbyte = 4; short @short = 5; uint @uint = 6; ulong @ulong = 7; ushort @ushort = 8; MyEnum @enum = MyEnum.EnumValue3; using (mocks.Record()) { randomGenerator.Expect(x => x.Boolean()).Return(@bool); randomGenerator.Expect(x => x.Byte()).Return(@byte); randomGenerator.Expect(x => x.Char()).Return(@char); randomGenerator.Expect(x => x.DateTime()).Return(dateTime); randomGenerator.Expect(x => x.Decimal()).Return(@decimal); randomGenerator.Expect(x => x.Double()).Return(@double); randomGenerator.Expect(x => x.Float()).Return(@float); randomGenerator.Expect(x => x.Guid()).Return(guid); randomGenerator.Expect(x => x.Int()).Return(@int); randomGenerator.Expect(x => x.Long()).Return(@long); randomGenerator.Expect(x => x.Phrase(50)).Return(@phrase); randomGenerator.Expect(x => x.SByte()).Return(@sbyte); randomGenerator.Expect(x => x.Short()).Return(@short); randomGenerator.Expect(x => x.UInt()).Return(@uint); randomGenerator.Expect(x => x.ULong()).Return(@ulong); randomGenerator.Expect(x => x.UShort()).Return(@ushort); randomGenerator.Expect(x => x.Enumeration(typeof(MyEnum))).Return(@enum); } }
public void SetUp() { mocks = new MockRepository(); randomGenerator = mocks.DynamicMock <IRandomGenerator>(); target = new ExtensibleRandomValuePropertyNamer(randomGenerator); bool @bool = true; byte @byte = 1; char @char = 'a'; var dateTime = new DateTime(2009, 01, 01); decimal @decimal = 1m; double @double = 1d; float @float = 1f; Guid guid = new Guid(); int @int = 2; long @long = 3; string phrase = "some text"; sbyte @sbyte = 4; short @short = 5; uint @uint = 6; ulong @ulong = 7; ushort @ushort = 8; MyEnum @enum = MyEnum.EnumValue3; using (mocks.Record()) { randomGenerator.Expect(x => x.Boolean()).Return(@bool); randomGenerator.Expect(x => x.Byte()).Return(@byte); randomGenerator.Expect(x => x.Char()).Return(@char); randomGenerator.Expect(x => x.DateTime()).Return(dateTime); randomGenerator.Expect(x => x.Decimal()).Return(@decimal); randomGenerator.Expect(x => x.Double()).Return(@double); randomGenerator.Expect(x => x.Float()).Return(@float); randomGenerator.Expect(x => x.Guid()).Return(guid); randomGenerator.Expect(x => x.Int()).Return(@int); randomGenerator.Expect(x => x.Long()).Return(@long); randomGenerator.Expect(x => x.Phrase(50)).Return(@phrase); randomGenerator.Expect(x => x.SByte()).Return(@sbyte); randomGenerator.Expect(x => x.Short()).Return(@short); randomGenerator.Expect(x => x.UInt()).Return(@uint); randomGenerator.Expect(x => x.ULong()).Return(@ulong); randomGenerator.Expect(x => x.UShort()).Return(@ushort); randomGenerator.Expect(x => x.Enumeration(typeof(MyEnum))).Return(@enum); } }