本文整理汇总了C#中IRandomGenerator.Expect方法的典型用法代码示例。如果您正苦于以下问题:C# IRandomGenerator.Expect方法的具体用法?C# IRandomGenerator.Expect怎么用?C# IRandomGenerator.Expect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRandomGenerator
的用法示例。
在下文中一共展示了IRandomGenerator.Expect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
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);
}
示例2: SetUp
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);
}
}