示例#1
0
        public void do_not_blow_up_building_one()
        {
            var storage = DocumentStorageBuilder.Build(null, new DocumentMapping(typeof(User)));

            storage.ShouldNotBeNull();


            storage.IdType.ShouldBe(NpgsqlDbType.Uuid);
        }
示例#2
0
        public void implements_the_id_type()
        {
            DocumentStorageBuilder.Build(null, new DocumentMapping(typeof(User))).IdType.ShouldBe(NpgsqlDbType.Uuid);

            var schema = Container.For <DevelopmentModeRegistry>().GetInstance <IDocumentSchema>();

            DocumentStorageBuilder.Build(schema, typeof(IntDoc)).IdType.ShouldBe(NpgsqlDbType.Integer);
            DocumentStorageBuilder.Build(schema, typeof(LongDoc)).IdType.ShouldBe(NpgsqlDbType.Bigint);
            DocumentStorageBuilder.Build(null, typeof(StringDoc)).IdType.ShouldBe(NpgsqlDbType.Text);
        }
示例#3
0
        public void do_not_blow_up_building_more_than_one()
        {
            var mappings = new[]
            {
                new DocumentMapping(typeof(User)),
                new DocumentMapping(typeof(Company)),
                new DocumentMapping(typeof(Issue))
            };

            DocumentStorageBuilder.Build(null, mappings).Count()
            .ShouldBe(3);
        }
示例#4
0
        public void implements_the_identity_method()
        {
            var schema = Container.For <DevelopmentModeRegistry>().GetInstance <IDocumentSchema>();

            var guid = Guid.NewGuid();

            DocumentStorageBuilder.Build(schema, typeof(IntDoc)).Identity(new IntDoc {
                Id = 3
            }).ShouldBe(3);
            DocumentStorageBuilder.Build(schema, typeof(LongDoc)).Identity(new LongDoc {
                Id = 4
            }).ShouldBe(4L);
            DocumentStorageBuilder.Build(null, typeof(StringDoc)).Identity(new StringDoc {
                Id = "abc"
            }).ShouldBe("abc");
            DocumentStorageBuilder.Build(null, typeof(User)).Identity(new User {
                Id = guid
            }).ShouldBe(guid);
        }
示例#5
0
        public void generates_the_resolve_method()
        {
            var storage = DocumentStorageBuilder.Build(null, DocumentMapping.For <User>());

            storage.ShouldBeAssignableTo <IResolver <User> >();
        }
        public void do_not_blow_up_building_one()
        {
            var storage = DocumentStorageBuilder.Build(new DocumentMapping(typeof(User)));

            storage.ShouldNotBeNull();
        }
示例#7
0
 public void generate_document_storage_code_for_the_hierarchy_without_blowing_up()
 {
     DocumentStorageBuilder.Build(null, theHierarchy).ShouldNotBeNull();
 }