public void Complex_types_is_not_null_but_empty_by_default() { var mongoDbModelAnnotations = new MongoDbModelAnnotations(new Model()); Assert.NotNull(mongoDbModelAnnotations.ComplexTypes); Assert.Empty(mongoDbModelAnnotations.ComplexTypes); }
public void Can_write_database_name() { var mongoDbModelAnnotations = new MongoDbModelAnnotations(new Model()) { Database = "test" }; Assert.Equal(expected: "test", actual: mongoDbModelAnnotations.Database); }
public MongoDbModelBuilder([NotNull] InternalModelBuilder internalModelBuilder, ConfigurationSource configurationSource) { Check.NotNull(internalModelBuilder, nameof(internalModelBuilder)); if (!Enum.IsDefined(typeof(ConfigurationSource), configurationSource)) { throw new ArgumentOutOfRangeException(nameof(configurationSource), $"{configurationSource} is not a valid {nameof(Microsoft.EntityFrameworkCore.Metadata.Internal.ConfigurationSource)} value."); } InternalModelBuilder = internalModelBuilder; ConfigurationSource = configurationSource; MongoDbModelAnnotations = new MongoDbModelAnnotations(internalModelBuilder.Metadata); }
public void Can_add_complex_type() { var model = new Model(); var entityType = new EntityType(typeof(RootType), model, ConfigurationSource.Explicit); var mongoDbModelAnnotations = new MongoDbModelAnnotations(model) { ComplexTypes = { entityType } }; Assert.True(mongoDbModelAnnotations.ComplexTypes.Contains(entityType)); }
public void Database_name_null_by_default() { var mongoDbModelAnnotations = new MongoDbModelAnnotations(new Model()); Assert.Null(mongoDbModelAnnotations.Database); }