asiftasleem / nbuilder

Automatically exported from code.google.com/p/nbuilder
0 stars 0 forks source link

Multiple WhereRandoms will conflict with each other and take items from each other's declarations #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This test fails.

[Test]
        public void Where_random_test()
        {
            var items = Builder<MyClass>.CreateListOfSize(40)
                .WhereRandom(10)
                    .Have(x => x.EnumProperty = MyEnum.EnumValue1)
                .WhereRandom(10)
                    .Have(x => x.EnumProperty = MyEnum.EnumValue2)
                .WhereRandom(10)
                    .Have(x => x.EnumProperty = MyEnum.EnumValue3)
                .WhereRandom(10)
                    .Have(x => x.EnumProperty = MyEnum.EnumValue4)
                .Build();

            Assert.That(items.Count(), Is.EqualTo(40));
            Assert.That(items.Count(x => x.EnumProperty ==
MyEnum.EnumValue1), Is.EqualTo(10));
            Assert.That(items.Count(x => x.EnumProperty ==
MyEnum.EnumValue2), Is.EqualTo(10));
            Assert.That(items.Count(x => x.EnumProperty ==
MyEnum.EnumValue3), Is.EqualTo(10));
            Assert.That(items.Count(x => x.EnumProperty ==
MyEnum.EnumValue4), Is.EqualTo(10));
        }

Original issue reported on code.google.com by garethdo...@googlemail.com on 11 Jun 2009 at 8:01

GoogleCodeExporter commented 8 years ago

Original comment by garethdo...@googlemail.com on 11 Jun 2009 at 11:39