Example #1
0
 public void Create_SpecifiedActionsTakePrecedenceOverRememberedActions_WhenBothRememberedAndSpecified()
 {
     var faker = new FakeCreator();
     faker.Remember<InternalTestClass>(x => x.Prop1 = "hi");
     var obj = faker.Fake<InternalTestClass>(x => x.Prop1 = "bye");
     Assert.AreEqual("bye", obj.Prop1);
 }
Example #2
0
        public void Remeber_AddsMappingsToRemembered()
        {
            var faker = new FakeCreator();

            faker.Remember <InternalTestClass>(x => x.Prop1 = "hi", x => x.Field1 = "bye");
            Assert.AreEqual(2, faker.GetRememberedActions <InternalTestClass>().Length);
        }
Example #3
0
 public void Fake_UsesRememberedActions()
 {
     var faker = new FakeCreator();
     faker.Remember<InternalTestClass>(x => x.Prop1 = "hi", x => x.Field1 = "bye");
     var obj = faker.Fake<InternalTestClass>();
     Assert.AreEqual("hi", obj.Prop1);
     Assert.AreEqual("bye", obj.Field1);
 }
Example #4
0
 public void Forget_CanClearActionsForSingleClass()
 {
     var faker = new FakeCreator();
     faker.Remember<InternalTestClass>(x => x.Prop1 = "hi");
     faker.Remember<PublicTestClass>(x => x.Field1 = "bye");
     faker.Forget<InternalTestClass>();
     Assert.AreEqual(0, faker.GetRememberedActions<InternalTestClass>().Length);
     Assert.AreEqual(1, faker.GetRememberedActions<PublicTestClass>().Length);
 }
Example #5
0
 public void ForgetAll_ClearsAllActionsForAllClasses()
 {
     var faker = new FakeCreator();
     faker.Remember<InternalTestClass>(x => x.Prop1 = "hi");
     faker.Remember<PublicTestClass>(x => x.Field1 = "bye");
     faker.ForgetAll();
     Assert.AreEqual(0, faker.GetRememberedActions<InternalTestClass>().Length);
     Assert.AreEqual(0, faker.GetRememberedActions<PublicTestClass>().Length);
 }
Example #6
0
        public void Create_SpecifiedActionsTakePrecedenceOverRememberedActions_WhenBothRememberedAndSpecified()
        {
            var faker = new FakeCreator();

            faker.Remember <InternalTestClass>(x => x.Prop1 = "hi");
            var obj = faker.Fake <InternalTestClass>(x => x.Prop1 = "bye");

            Assert.AreEqual("bye", obj.Prop1);
        }
Example #7
0
        public void Forget_CanClearActionsForSingleClass()
        {
            var faker = new FakeCreator();

            faker.Remember <InternalTestClass>(x => x.Prop1 = "hi");
            faker.Remember <PublicTestClass>(x => x.Field1  = "bye");
            faker.Forget <InternalTestClass>();
            Assert.AreEqual(0, faker.GetRememberedActions <InternalTestClass>().Length);
            Assert.AreEqual(1, faker.GetRememberedActions <PublicTestClass>().Length);
        }
Example #8
0
        public void Fake_UsesRememberedActions()
        {
            var faker = new FakeCreator();

            faker.Remember <InternalTestClass>(x => x.Prop1 = "hi", x => x.Field1 = "bye");
            var obj = faker.Fake <InternalTestClass>();

            Assert.AreEqual("hi", obj.Prop1);
            Assert.AreEqual("bye", obj.Field1);
        }
Example #9
0
        public void ForgetAll_ClearsAllActionsForAllClasses()
        {
            var faker = new FakeCreator();

            faker.Remember <InternalTestClass>(x => x.Prop1 = "hi");
            faker.Remember <PublicTestClass>(x => x.Field1  = "bye");
            faker.ForgetAll();
            Assert.AreEqual(0, faker.GetRememberedActions <InternalTestClass>().Length);
            Assert.AreEqual(0, faker.GetRememberedActions <PublicTestClass>().Length);
        }
Example #10
0
 public void Remeber_AddsMappingsToRemembered()
 {
     var faker = new FakeCreator();
     faker.Remember<InternalTestClass>(x => x.Prop1 = "hi", x => x.Field1 = "bye");
     Assert.AreEqual(2, faker.GetRememberedActions<InternalTestClass>().Length);
 }
Example #11
0
 private static T CreateFake(Action <IFakeOptions <T> > optionsBuilder)
 {
     return(FakeCreator.CreateFake(optionsBuilder));
 }
 public DataGenerator()
 {
     this.fakeCreator = new FakeCreator();
     this.rdg = RDG.Instance;
 }