private void AcceptChanges()
        {
            var tablesToProcess = SelectedTables;

            MappingProcessor proc = new MappingProcessor(new OneToOneEntityProcessor(Set.EntitySet.Entities.Select(e => e.Name)));

            proc.CreateOneToOneMappingsFor(tablesToProcess, Set);
            Close();
            //mainPanel.CloseDatabaseRefreshResultsForm(Changes.WereAccepted);
        }
        public void Correct_Entities_Are_Created()
        {
            EntityProcessor proc = MockRepository.GenerateMock <EntityProcessor>();

            Entity entity1 = new EntityImpl();

            proc.Stub(p => p.CreateEntity(Table1)).Return(entity1);

            MappingProcessor mappingProc = new MappingProcessor(proc);

            mappingProc.CreateOneToOneMappingsFor(new[] { Table1 }, Set);

            proc.AssertWasCalled(p => p.CreateEntity(Table1));
            proc.AssertWasNotCalled(p => p.CreateEntity(Table2));
        }
        public void Correct_References_Are_Created()
        {
            EntityProcessor proc = MockRepository.GenerateMock <EntityProcessor>();

            Entity    entity1   = new EntityImpl();
            Entity    entity2   = new EntityImpl();
            Reference reference = new ReferenceImpl(entity1, entity2);

            proc.Stub(p => p.CreateEntity(Table1)).Return(entity1);
            proc.Stub(p => p.CreateEntity(Table2)).Return(entity2);
            proc.Stub(p => p.CreateReference(Relationship12, Set.EntitySet)).Return(reference);

            MappingProcessor mappingProc = new MappingProcessor(proc);

            mappingProc.CreateOneToOneMappingsFor(new[] { Table1, Table2 }, Set);

            proc.AssertWasCalled(p => p.CreateEntity(Table1));
            proc.AssertWasCalled(p => p.CreateEntity(Table2));
            proc.AssertWasCalled(p => p.CreateReference(Relationship12, Set.EntitySet));
            proc.AssertWasNotCalled(p => p.CreateReference(Relationship13, Set.EntitySet));
        }