Exemplo n.º 1
0
        public void SetUp()
        {
            mainPanel = MockRepository.GenerateStub <IMainPanel>();
            form      = MockRepository.GenerateMock <IEntityForm>();
            ms        = MockRepository.GenerateStub <MappingSet>();

            Property  property = new PropertyImpl("Prop1");
            EntityKey key      = new EntityKeyImpl();

            entity = new EntityImpl("Entity1")
            {
                Key = key
            };
            entity.AddProperty(property);
            key.AddProperty(property);

            mapping = new MappingImpl();
            form.Stub(f => f.Mappings).Return(new List <Mapping> {
                mapping
            });

            EntitySet es = new EntitySetImpl();

            es.AddEntity(entity);
            ms.EntitySet  = es;
            es.MappingSet = ms;
            ms.Stub(m => m.GetMappingsContaining(entity)).Return(new List <Mapping>());

            var presenter = new EntityPresenter(mainPanel, form);

            presenter.AttachToModel(entity);
        }
Exemplo n.º 2
0
        public void Triggering_The_ParentEntityChanged_Event_Changes_The_Parent()
        {
            IMainPanel  mainPanel = MockRepository.GenerateStub <IMainPanel>();
            IEntityForm form      = MockRepository.GenerateMock <IEntityForm>();
            Entity      entity    = MockRepository.GenerateMock <Entity>();

            form.Stub(f => f.ParentEntity).Return(new EntityImpl("Parent2"));

            var presenter = new EntityPresenter(mainPanel, form);

            presenter.AttachToModel(entity);

            form.Raise(f => f.ParentEntityChanged += null, form, new EventArgs());

            entity.AssertWasCalled(e => e.Parent = form.ParentEntity);
        }
        public void SetUp()
        {
            mainPanel = MockRepository.GenerateStub<IMainPanel>();
            form = MockRepository.GenerateMock<IEntityForm>();
            ms = MockRepository.GenerateStub<MappingSet>();

            Property property = new PropertyImpl("Prop1");
            EntityKey key = new EntityKeyImpl();
            entity = new EntityImpl("Entity1") { Key = key };
            entity.AddProperty(property);
            key.AddProperty(property);

            mapping = new MappingImpl();
            form.Stub(f => f.Mappings).Return(new List<Mapping> { mapping });

            EntitySet es = new EntitySetImpl();
            es.AddEntity(entity);
            ms.EntitySet = es;
            es.MappingSet = ms;
            ms.Stub(m => m.GetMappingsContaining(entity)).Return(new List<Mapping>());

            var presenter = new EntityPresenter(mainPanel, form);
            presenter.AttachToModel(entity);
        }