当前位置: 首页>>代码示例>>C#>>正文


C# IRandomGenerator.Expect方法代码示例

本文整理汇总了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);
        }
开发者ID:QuarterSpot,项目名称:nbuilder,代码行数:19,代码来源:RandomValuePropertyNamerTests_LoremIpsumStrings.cs

示例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);
            }
        }
开发者ID:nbuilder,项目名称:nbuilder,代码行数:47,代码来源:ExtensibileRandomValuePropertyNamerTests.cs


注:本文中的IRandomGenerator.Expect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。