Ejemplo n.º 1
0
        public void finds_the_id_member_with_the_attribute_on_a_property()
        {
            var mapping = DocumentMapping.For <NonStandardWithProp>();

            mapping.IdMember.Name.ShouldBe(nameof(NonStandardWithProp.Name));
        }
Ejemplo n.º 2
0
 public void use_the_default_pg_type_for_the_member_type_if_not_overridden()
 {
     DocumentMapping.For <Customer>().DatabaseSchemaName.ShouldBe("organization");
 }
Ejemplo n.º 3
0
        public void finds_the_id_member_with_the_attribute_on_a_field()
        {
            var mapping = DocumentMapping.For <NonStandardDoc>();

            mapping.IdMember.Name.ShouldBe(nameof(NonStandardDoc.Name));
        }
Ejemplo n.º 4
0
 public void upsert_name_for_document_type()
 {
     DocumentMapping.For <MySpecialDocument>().UpsertFunction.Name
     .ShouldBe("mt_upsert_documentmappingtests_myspecialdocument");
 }
Ejemplo n.º 5
0
        public void document_type_decorated_with_attribute()
        {
            var mapping = DocumentMapping.For <TenantedDoc>();

            mapping.TenancyStyle.ShouldBe(TenancyStyle.Conjoined);
        }
Ejemplo n.º 6
0
        public void default_search_mode_is_jsonb_to_record()
        {
            var mapping = DocumentMapping.For <User>();

            mapping.PropertySearching.ShouldBe(PropertySearching.JSON_Locator_Only);
        }
Ejemplo n.º 7
0
        public void default_table_name_with_different_shema()
        {
            var mapping = DocumentMapping.For <User>("other");

            mapping.Table.QualifiedName.ShouldBe("other.mt_doc_user");
        }
Ejemplo n.º 8
0
        public void uses_ConfigureMarten_method_to_alter_mapping_upon_construction()
        {
            var mapping = DocumentMapping.For <ConfiguresItself>();

            mapping.Alias.ShouldBe("different");
        }
Ejemplo n.º 9
0
        public void uses_ConfigureMarten_method_to_alter_mapping_upon_construction_with_the_generic_signature()
        {
            var mapping = DocumentMapping.For <ConfiguresItselfSpecifically>();

            mapping.DuplicatedFields.Single().MemberName.ShouldBe(nameof(ConfiguresItselfSpecifically.Name));
        }
Ejemplo n.º 10
0
 public void use_hilo_id_generation_for_long_id()
 {
     DocumentMapping.For <LongId>()
     .IdStrategy.ShouldBeOfType <HiloIdGeneration>();
 }
Ejemplo n.º 11
0
        public void use_string_id_generation_for_string()
        {
            var mapping = DocumentMapping.For <StringId>();

            mapping.IdStrategy.ShouldBeOfType <StringIdGeneration>();
        }
Ejemplo n.º 12
0
        public void use_guid_id_generation_for_guid_id()
        {
            var mapping = DocumentMapping.For <UpperCaseProperty>();

            mapping.IdStrategy.ShouldBeOfType <CombGuidIdGeneration>();
        }
Ejemplo n.º 13
0
 public void use_custom_default_id_generation_for_long_id()
 {
     DocumentMapping.For <LongId>(idGeneration: (m, o) => new CustomIdGeneration())
     .IdStrategy.ShouldBeOfType <CustomIdGeneration>();
 }
Ejemplo n.º 14
0
 public void upsert_name_with_schema_for_document_type_on_other_schema()
 {
     DocumentMapping.For <MySpecialDocument>("other").UpsertFunction.QualifiedName
     .ShouldBe("other.mt_upsert_documentmappingtests_myspecialdocument");
 }
Ejemplo n.º 15
0
        public void finds_the_right_id_member_for_doc_with_both_id_column_and_identity_attribute()
        {
            var mapping = DocumentMapping.For <IdAndIdentityAttDoc>();

            mapping.IdMember.Name.ShouldBe(nameof(IdAndIdentityAttDoc.DocumentId));
        }
Ejemplo n.º 16
0
 public void trying_to_index_deleted_at_when_not_soft_deleted_document_throws()
 {
     Exception <InvalidOperationException> .ShouldBeThrownBy(() => DocumentMapping.For <IntId>().AddDeletedAtIndex());
 }
Ejemplo n.º 17
0
        public void default_alias_for_a_type_that_is_not_nested()
        {
            var mapping = DocumentMapping.For <User>();

            mapping.Alias.ShouldBe("user");
        }
 public void default_delete_style_is_remove()
 {
     DocumentMapping.For <User>()
     .DeleteStyle.ShouldBe(DeleteStyle.Remove);
 }
Ejemplo n.º 19
0
        public void default_table_name()
        {
            var mapping = DocumentMapping.For <User>();

            mapping.Table.Name.ShouldBe("mt_doc_user");
        }
 public void can_be_configured_by_attribute()
 {
     DocumentMapping.For <SoftDeletedDoc>()
     .DeleteStyle.ShouldBe(DeleteStyle.SoftDelete);
 }
Ejemplo n.º 21
0
        public void default_table_name_with_schema()
        {
            var mapping = DocumentMapping.For <User>();

            mapping.Table.QualifiedName.ShouldBe("public.mt_doc_user");
        }
Ejemplo n.º 22
0
 public void trying_to_replace_the_hilo_settings_when_not_using_hilo_for_the_sequence_throws()
 {
     Exception <InvalidOperationException> .ShouldBeThrownBy(
         () => { DocumentMapping.For <StringId>().HiloSettings = new HiloSettings(); });
 }