Пример #1
0
        public DocumentReadWriteTests()
        {
            _documentServer = new DocumentServer(Constants.ConnectionString);

            ResetDatabase()
            .GetAwaiter()
            .GetResult();
        }
Пример #2
0
        public CollectionModelPackageTests()
        {
            _documentServer = new DocumentServer(Constants.ConnectionString);

            _documentServer.DropDatabase(_workContext, _dbName)
            .GetAwaiter()
            .GetResult();
        }
Пример #3
0
        public DocumentDatabase(IDocumentServer documentServer, IMongoDatabase mongoDatabase)
        {
            Verify.IsNotNull(nameof(documentServer), documentServer);
            Verify.IsNotNull(nameof(mongoDatabase), mongoDatabase);

            DocumentServer = documentServer;
            MongoDatabase  = mongoDatabase;
        }
Пример #4
0
        public CappedCollectionModelPackageTests()
        {
            string databaseName = $"TestCappedDatabase_{nameof(CappedCollectionModelPackageTests)}";

            _documentServer = new DocumentServer(Constants.ConnectionString);

            _documentServer
            .DropDatabase(_workContext, databaseName)
            .GetAwaiter()
            .GetResult();

            _documentDatabase = new DocumentDatabase(new DatabaseConfigurationBuilder(Constants.ConnectionString, databaseName).ToString());
        }
Пример #5
0
        public DocumentSearchTests()
        {
            _documentServer = new DocumentServer(Constants.ConnectionString);

            _testDocuments = Enumerable.Range(0, 10)
                             .Select(x => CreateTestDocument(x))
                             .OrderBy(x => x._id)
                             .ToList();

            IDocumentDatabase db = _documentServer.GetDatabase(_workContext, _dbName);

            _collection = db.GetCollection <TestDocument>(_collectionName);

            ResetDatabase()
            .GetAwaiter()
            .GetResult();
        }
Пример #6
0
 public CreateRemoveDatabaseTests()
 {
     _documentServer = new DocumentServer(Constants.ConnectionString);
 }
        public AdministrationRepository(IIdentityConfiguration identityConfiguration)
        {
            Verify.IsNotNull(nameof(identityConfiguration), identityConfiguration);
            Verify.IsNotEmpty(nameof(identityConfiguration.DatabaseName), identityConfiguration.DatabaseName);
            Verify.IsNotEmpty(nameof(identityConfiguration.IdentityRoleCollectionName), identityConfiguration.IdentityRoleCollectionName);
            Verify.IsNotEmpty(nameof(identityConfiguration.IdentityUserCollectionName), identityConfiguration.IdentityUserCollectionName);

            _configuration  = identityConfiguration;
            _documentServer = new DocumentServer(_configuration.ConnectionString);

            _models = new CollectionModel[]
            {
                new CollectionModel
                {
                    CollectionName = identityConfiguration.IdentityRoleCollectionName,
                    Indexes        = new CollectionIndex[]
                    {
                        new CollectionIndex
                        {
                            Name   = $"{nameof(UserRoleDoc.RoleId)}_index",
                            Unique = true,
                            Keys   = new IndexKey[]
                            {
                                new IndexKey {
                                    FieldName = HeaderDoc.FieldName(nameof(UserRoleDoc.RoleId)), Descending = false
                                },
                            }
                        }
                    }
                },

                new CollectionModel
                {
                    CollectionName = identityConfiguration.IdentityUserCollectionName,
                    Indexes        = new CollectionIndex[]
                    {
                        new CollectionIndex
                        {
                            Name   = $"{nameof(UserDoc.NormalizedEmail)}_index",
                            Unique = false,
                            Keys   = new IndexKey[]
                            {
                                new IndexKey {
                                    FieldName = HeaderDoc.FieldName(nameof(UserDoc.NormalizedEmail)), Descending = false
                                },
                            }
                        },
                        new CollectionIndex
                        {
                            Name   = $"{nameof(UserDoc.NormalizedUserName)}_index",
                            Unique = true,
                            Keys   = new IndexKey[]
                            {
                                new IndexKey {
                                    FieldName = HeaderDoc.FieldName(nameof(UserDoc.NormalizedUserName)), Descending = false
                                },
                            }
                        }
                    }
                }
            };
        }
Пример #8
0
 public CollectionIndexTests()
 {
     _documentServer = new DocumentServer(Constants.ConnectionString);
 }