public void Test_GenerateValue_WhenSavedItems_ShouldReturnSavedItems()
        {
            //---------------Set up test pack-------------------
            var savedItems     = Create3SavedBOs();
            var valueGenerator = new ValidValueGeneratorFromBOList <FakeBO2>(GetRelDef <FakeBO2>(), null);

            //---------------Assert Precondition----------------
            Assert.AreEqual(3, LoadBOs().Count);
            Assert.AreEqual(3, valueGenerator.AvailableItemsList.Count);
            //---------------Execute Test ----------------------
            var value1 = valueGenerator.GenerateValidValue() as FakeBO2;
            var value2 = valueGenerator.GenerateValidValue() as FakeBO2;

            //---------------Test Result -----------------------
            savedItems.ShouldContain(value2);
            savedItems.ShouldContain(value1);
        }
        public void Test_GenerateValue_WhenUseDifferentValueDefs_ShouldNotGenerateSequentialValues_FixBug1267()
        {
            //---------------Set up test pack-------------------
            var fakeBo2s        = GetList();
            var relDef1         = GetRelDef <FakeBO2>();
            var relDef2         = GetRelDef <FakeBO2>();
            var valueGenerator1 = new ValidValueGeneratorFromBOList <FakeBO2>(relDef1, fakeBo2s);
            var valueGenerator2 = new ValidValueGeneratorFromBOList <FakeBO2>(relDef2, fakeBo2s);

            //---------------Assert Precondition----------------
            Assert.AreNotSame(valueGenerator1.SingleValueDef, valueGenerator2.SingleValueDef);
            //---------------Execute Test ----------------------
            var valueFromGenerator1 = valueGenerator1.GenerateValidValue();
            var valueFromGenerator2 = valueGenerator2.GenerateValidValue();

            //---------------Test Result -----------------------
            Assert.AreEqual(valueFromGenerator1, valueFromGenerator2, "Should both return the first value since generating for different prop defs");
        }
        public void Test_GenerateValue_WhenUseDifferentGeneratorInstances_ButSameValueDef_ShouldGenerateDifferentValues()
        {
            //---------------Set up test pack-------------------
            var relDef = GetRelDef <FakeBO2>();

            Create3SavedBOs();
            var valueGenerator1 = new ValidValueGeneratorFromBOList <FakeBO2>(relDef, null);
            var valueGenerator2 = new ValidValueGeneratorFromBOList <FakeBO2>(relDef, null);

            //---------------Assert Precondition----------------
            Assert.AreSame(relDef, valueGenerator1.SingleValueDef);
            Assert.AreSame(relDef, valueGenerator1.SingleValueDef);
            Assert.AreNotSame(valueGenerator1, valueGenerator2);
            //---------------Execute Test ----------------------
            var valueFromGenerator1 = valueGenerator1.GenerateValidValue();
            var valueFromGenerator2 = valueGenerator2.GenerateValidValue();

            //---------------Test Result -----------------------
            Assert.AreNotEqual(valueFromGenerator2, valueFromGenerator1);
        }