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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
private static T CreateFake(Action <IFakeOptions <T> > optionsBuilder) { return(FakeCreator.CreateFake(optionsBuilder)); }
public DataGenerator() { this.fakeCreator = new FakeCreator(); this.rdg = RDG.Instance; }