示例#1
0
        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);
        }
示例#2
0
        public void Can_write_database_name()
        {
            var mongoDbModelAnnotations = new MongoDbModelAnnotations(new Model())
            {
                Database = "test"
            };

            Assert.Equal(expected: "test", actual: mongoDbModelAnnotations.Database);
        }
示例#3
0
 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);
 }
示例#4
0
        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));
        }
示例#5
0
        public void Database_name_null_by_default()
        {
            var mongoDbModelAnnotations = new MongoDbModelAnnotations(new Model());

            Assert.Null(mongoDbModelAnnotations.Database);
        }