public void property_remains_the_same_if_no_substitution_was_added()
        {
            //arrange
            UserModel model = new UserModel() { Id = 100, Name = "John" };
            var subsItem = Configurator.SubstitutesFor(model.GetType());

            //act
            EntitySubstitutor.EntityToReal<UserModel>(model);

            //assert
            Assert.AreEqual(100, model.Id, "Id should be the same as we didn`t configure the substitutable.");
        }
        public void single_id_property_is_substituted()
        {
            //arrange
            Configurator.Substitute<UserModel, int>(x => x.Id);

            UserModel model = new UserModel(){Id=100, Name="John"};
            var subsItem = Configurator.SubstitutesFor(model.GetType());

            //act
            EntitySubstitutor.EntityToReal<UserModel>(model);

            //assert
            Assert.AreEqual(10, model.Id, "Id should be substituted to real");
        }
        public void property_set_to_value_provided()
        {
            //arrange
            UserModel model = new UserModel() { Id = 111, Name = "John" };
            Configurator.Substitute<UserModel, int>(x => x.Id);

            Substitutable subs = Configurator.SubstitutesFor(typeof(UserModel)).First();

            //act
            ReflectionHelper.SetValue<UserModel>(model, subs, 10);

            //assert
            Assert.AreEqual(10, model.Id);
        }
        public void property_value_received_by_substitutable()
        {
            //arrange
            UserModel model = new UserModel() { Id = 111, Name = "John" };
            Configurator.Substitute<UserModel, int>(x => x.Id);

            Substitutable subs = Configurator.SubstitutesFor(typeof(UserModel)).First();

            //act
            int res = ReflectionHelper.GetValue<UserModel>(model, subs);

            //assert
            Assert.AreEqual(111, res);
            //Assert.AreNotEqual(1, model.Id);
        }