Ejemplo n.º 1
0
        public void bind_model_should_be_null_when_the_id_is_null()
        {
            using (var nested = container.GetNestedContainer())
            {
                var context = nested.GetInstance <IBindingContext>();
                var binder  = new EntityModelBinder();

                binder.Bind(typeof(Site), context).ShouldBeOfType <Site>()
                .Id.ShouldEqual(Guid.Empty);
            }
        }
Ejemplo n.º 2
0
        public void bind_model_should_return_the_correct_entity_if_the_Id_is_a_guid()
        {
            using (var nested = container.GetNestedContainer())
            {
                var site = new Site();
                nested.GetInstance <IRepository>().Save(site);
                requestData["Id"] = site.Id.ToString();

                var context = nested.GetInstance <IBindingContext>();
                var binder  = new EntityModelBinder();

                binder.Bind(typeof(Site), context).ShouldBeOfType <Site>().Id.ShouldEqual(site.Id);
            }
        }