public void get_name_for_applies_prefix_from_view()
        {
            var view = new FakeViewModelContainer <FakeModel>("prefix");
            Expression <Func <FakeModel, object> > expression = x => x.Person.FirstName;

            expression.GetNameFor(view).ShouldEqual("prefix.Person.FirstName");
        }
        public void get_name_for_applies_prefix_from_view_to_collection_model()
        {
            var view = new FakeViewModelContainer <IList <FakeModel> >("prefix");
            Expression <Func <IList <FakeModel>, object> > expression = x => x[123].Person.FirstName;

            expression.GetNameFor(view).ShouldEqual("prefix[123].Person.FirstName");
        }
 public void can_get_index_element_with_value()
 {
     target = new FakeViewModelContainer<FakeModel>("fake") {ViewModel = fake};
     var element = target.Index(x => x, x => x.Id);
     element.AttributeShouldEqual(HtmlAttribute.Name, "fake.Index");
     element.ValueAttributeShouldEqual(fake.Id.ToString());
 }
 public void can_get_index_element()
 {
     target = new FakeViewModelContainer<FakeModel>("fake") { ViewModel = fake };
     var element = target.Index(x => x, x => x.Id);
     element.AttributeShouldEqual(HtmlAttribute.Name, "fake.Index");
     element.AttributeShouldEqual(HtmlAttribute.Id, "fake_Index_" + fake.Id);
 }
        public void can_get_index_element_with_value()
        {
            target = new FakeViewModelContainer <FakeModel>("fake")
            {
                ViewModel = fake
            };
            var element = target.Index(x => x, x => x.Id);

            element.AttributeShouldEqual(HtmlAttribute.Name, "fake.Index");
            element.ValueAttributeShouldEqual(fake.Id.ToString());
        }
        public void can_get_index_element()
        {
            target = new FakeViewModelContainer <FakeModel>("fake")
            {
                ViewModel = fake
            };
            var element = target.Index(x => x, x => x.Id);

            element.AttributeShouldEqual(HtmlAttribute.Name, "fake.Index");
            element.AttributeShouldEqual(HtmlAttribute.Id, "fake_Index_" + fake.Id);
        }
 public void SetUp()
 {
     target = new FakeViewModelContainer <FakeModel>();
     fake   = new FakeModel
     {
         Title  = "Test Title",
         Date   = DateTime.Now,
         Done   = true,
         Id     = 123,
         Person = new FakeChildModel
         {
             FirstName = "Mick",
             LastName  = "Jagger"
         },
         Numbers = new [] { 1, 3 }
     };
     target.ViewModel = fake;
 }
 public void SetUp()
 {
     target = new FakeViewModelContainer<FakeModel>();
     fake = new FakeModel
     {
         Title = "Test Title",
         Date = DateTime.Now,
         Done = true,
         Id = 123,
         Person = new FakeChildModel
         {
             FirstName = "Mick",
             LastName = "Jagger"
         },
         Numbers = new [] {1, 3}
     };
     target.ViewModel = fake;
 }
 public void get_name_for_applies_prefix_from_view_to_collection_model()
 {
     var view = new FakeViewModelContainer<IList<FakeModel>>("prefix");
     Expression<Func<IList<FakeModel>, object>> expression = x => x[123].Person.FirstName;
     expression.GetNameFor(view).ShouldEqual("prefix[123].Person.FirstName");
 }
 public void get_name_for_applies_prefix_from_view()
 {
     var view = new FakeViewModelContainer<FakeModel>("prefix");
     Expression<Func<FakeModel, object>> expression = x => x.Person.FirstName;
     expression.GetNameFor(view).ShouldEqual("prefix.Person.FirstName");
 }