public void MongoClientAccessorConstror(MongoClient mongoClient, string databaseName)
        {
            var clientAccessor = new MongoClientAccessor(mongoClient, databaseName);

            clientAccessor.MongoClient.Should().Be(mongoClient);
            clientAccessor.DatabaseName.Should().Be(databaseName);
        }
        private static MongoClientAccessor InternalMongoClientAccessorFactory(
            string connectionString, 
            string databaseName)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(connectionString));
            Contract.Requires(!string.IsNullOrWhiteSpace(databaseName));
            Contract.Ensures(Contract.Result<MongoClientAccessor>() != null);

            var client = new MongoClient(connectionString);
            var clientAccessor = new MongoClientAccessor(client, databaseName);

            return clientAccessor;
        }
示例#3
0
        private static MongoClientAccessor InternalMongoClientAccessorFactory(
            string connectionString,
            string databaseName)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(connectionString));
            Contract.Requires(!string.IsNullOrWhiteSpace(databaseName));
            Contract.Ensures(Contract.Result <MongoClientAccessor>() != null);

            var client         = new MongoClient(connectionString);
            var clientAccessor = new MongoClientAccessor(client, databaseName);

            return(clientAccessor);
        }
        public void Customize(IFixture fixture)
        {
            var client = new MongoClient(MongoPersistenceConstants.DefaultConnectionString);
            var clientAccessor = new MongoClientAccessor(client, "UnitTest");
            var databaseFactory = new MongoDatabaseFactory(clientAccessor);

            fixture.Register(() => client);
            fixture.Register(() => clientAccessor);
            fixture.Register(() => databaseFactory);

            fixture.Customize<TimeoutData>(
                c => c.With(t => t.OwningTimeoutManager, "UnitTests").With(t => t.Time, DateTime.UtcNow));

            fixture.Customize<MongoTimeoutPersister>(c => c.With(t => t.EndpointName, "UnitTests"));

            fixture.Customize(new SupportMutableValueTypesCustomization());

            TimeoutClassMaps.ConfigureClassMaps();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoDatabaseFactory"/> class.
 /// </summary>
 /// <param name="clientAccessor">
 /// The clientAccessor.
 /// </param>
 public MongoDatabaseFactory(MongoClientAccessor clientAccessor)
 {
     Contract.Requires<ArgumentNullException>(clientAccessor != null, "clientAccessor != null");
     this.mongoClientAccessor = clientAccessor;
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoDatabaseFactory"/> class.
 /// </summary>
 /// <param name="clientAccessor">
 /// The clientAccessor.
 /// </param>
 public MongoDatabaseFactory(MongoClientAccessor clientAccessor)
 {
     Contract.Requires <ArgumentNullException>(clientAccessor != null, "clientAccessor != null");
     this.mongoClientAccessor = clientAccessor;
 }