Exemplo n.º 1
0
        public void builds_schema_objects_on_the_fly_as_needed()
        {
            _schema.StorageFor(typeof(User)).ShouldNotBeNull();
            _schema.StorageFor(typeof(Issue)).ShouldNotBeNull();
            _schema.StorageFor(typeof(Company)).ShouldNotBeNull();

            var schema = new DocumentSchema(new ConnectionSource(), new DevelopmentSchemaCreation(new ConnectionSource()));
            var tables = schema.SchemaTableNames();

            tables.ShouldContain(DocumentMapping.TableNameFor(typeof(User)).ToLower());
            tables.ShouldContain(DocumentMapping.TableNameFor(typeof(Issue)).ToLower());
            tables.ShouldContain(DocumentMapping.TableNameFor(typeof(Company)).ToLower());

            var functions = schema.SchemaFunctionNames();

            functions.ShouldContain(DocumentMapping.UpsertNameFor(typeof(User)).ToLower());
            functions.ShouldContain(DocumentMapping.UpsertNameFor(typeof(Issue)).ToLower());
            functions.ShouldContain(DocumentMapping.UpsertNameFor(typeof(Company)).ToLower());
        }