static Tuple <object, bool, DateTime, string, double, Guid> CreateTuple6()
 {
     return(Tuple.From(
                (object)null,
                Rand.NextBool(),
                Rand.NextDate(),
                Rand.NextString(10, 23),
                Rand.NextDouble(),
                Rand.NextGuid()));
 }
示例#2
0
        public void Test()
        {
            Assert.AreEqual(534011718, Rand.Next());
            Assert.AreEqual(1, Rand.Next(10));
            Assert.AreEqual(34, Rand.Next(30, 40));
            Assert.AreEqual(0.77160412202198247d, Rand.NextDouble());
            Assert.AreEqual(3, Rand.NextItem(new[] { 1, 2, 3, 4 }));
            Assert.AreEqual(Option.Yes, Rand.NextEnum <Option>());
            Assert.AreNotEqual(0, Rand.NextString(1, 5).Length);
            Assert.AreEqual(new Guid("aefd513f-48a7-b49d-b3f3-172961cc2bcb"), Rand.NextGuid());
            Assert.AreEqual(new DateTime(590668128477790000), Rand.NextDate());
            Assert.AreEqual(new DateTime(633936311847180000), Rand.NextDate(2009, 2010));

            Assert.AreEqual(true, Rand.NextBool(1));
            Assert.AreEqual(false, Rand.NextBool(0));
            Assert.AreEqual(false, Rand.NextBool());

            Assert.AreEqual("accusam", Rand.String.NextWord());
            Assert.AreEqual("Sed stet amet in invidunt.", Rand.String.NextSentence(1, 6));
            var actual = Rand.String.NextText(20, 90);

            Assert.IsTrue(actual.Contains(Environment.NewLine));
            Assert.AreEqual(537, actual.Length);
            Assert.AreEqual(87, actual.Count(c => c == ' '));


            Assert.AreEqual(new[]
            {
                new Guid("df4ddcf6-69a5-8870-5860-e15353afd241"),
                new Guid("276152fa-f318-d27b-3871-ca2c3c022647"),
                new Guid("7e1926f3-d485-71aa-6ff0-f25ceb0e691c"),
            }, Rand.NextGuids(3));

            Assert.AreEqual(new[]
            {
                new Guid("820f5bd2-a0e3-6002-7ba6-339e434b553a"),
                new Guid("962d5f99-bb54-a826-f0b8-27011ee62907"),
                new Guid("a66a7dad-c516-850f-161d-0a2d76d22ca4"),
            }, Rand.NextGuids(1, 4));
        }