public void finds_the_id_member_with_the_attribute_on_a_property() { var mapping = DocumentMapping.For <NonStandardWithProp>(); mapping.IdMember.Name.ShouldBe(nameof(NonStandardWithProp.Name)); }
public void use_the_default_pg_type_for_the_member_type_if_not_overridden() { DocumentMapping.For <Customer>().DatabaseSchemaName.ShouldBe("organization"); }
public void finds_the_id_member_with_the_attribute_on_a_field() { var mapping = DocumentMapping.For <NonStandardDoc>(); mapping.IdMember.Name.ShouldBe(nameof(NonStandardDoc.Name)); }
public void upsert_name_for_document_type() { DocumentMapping.For <MySpecialDocument>().UpsertFunction.Name .ShouldBe("mt_upsert_documentmappingtests_myspecialdocument"); }
public void document_type_decorated_with_attribute() { var mapping = DocumentMapping.For <TenantedDoc>(); mapping.TenancyStyle.ShouldBe(TenancyStyle.Conjoined); }
public void default_search_mode_is_jsonb_to_record() { var mapping = DocumentMapping.For <User>(); mapping.PropertySearching.ShouldBe(PropertySearching.JSON_Locator_Only); }
public void default_table_name_with_different_shema() { var mapping = DocumentMapping.For <User>("other"); mapping.Table.QualifiedName.ShouldBe("other.mt_doc_user"); }
public void uses_ConfigureMarten_method_to_alter_mapping_upon_construction() { var mapping = DocumentMapping.For <ConfiguresItself>(); mapping.Alias.ShouldBe("different"); }
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)); }
public void use_hilo_id_generation_for_long_id() { DocumentMapping.For <LongId>() .IdStrategy.ShouldBeOfType <HiloIdGeneration>(); }
public void use_string_id_generation_for_string() { var mapping = DocumentMapping.For <StringId>(); mapping.IdStrategy.ShouldBeOfType <StringIdGeneration>(); }
public void use_guid_id_generation_for_guid_id() { var mapping = DocumentMapping.For <UpperCaseProperty>(); mapping.IdStrategy.ShouldBeOfType <CombGuidIdGeneration>(); }
public void use_custom_default_id_generation_for_long_id() { DocumentMapping.For <LongId>(idGeneration: (m, o) => new CustomIdGeneration()) .IdStrategy.ShouldBeOfType <CustomIdGeneration>(); }
public void upsert_name_with_schema_for_document_type_on_other_schema() { DocumentMapping.For <MySpecialDocument>("other").UpsertFunction.QualifiedName .ShouldBe("other.mt_upsert_documentmappingtests_myspecialdocument"); }
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)); }
public void trying_to_index_deleted_at_when_not_soft_deleted_document_throws() { Exception <InvalidOperationException> .ShouldBeThrownBy(() => DocumentMapping.For <IntId>().AddDeletedAtIndex()); }
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); }
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); }
public void default_table_name_with_schema() { var mapping = DocumentMapping.For <User>(); mapping.Table.QualifiedName.ShouldBe("public.mt_doc_user"); }
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(); }); }