public async Task Store_Should_Success()
        {
            var serviceProvider = Mock.Of <IServiceProvider>();

            var mongoCollection = new Mock <IMongoCollection <BsonDocument> >();

            var mongoDatabase = new Mock <IMongoDatabase>();

            mongoDatabase.Setup(d =>
                                d.GetCollection <BsonDocument>(It.IsAny <string>(), It.IsAny <MongoCollectionSettings>()))
            .Returns(mongoCollection.Object);

            var mongoClient = new Mock <IMongoClient>();

            mongoClient.Setup(d => d.GetDatabase(It.IsAny <string>(), It.IsAny <MongoDatabaseSettings>()))
            .Returns(mongoDatabase.Object);

            var mongoEntityStorage = new MongoEntityStorage(mongoClient.Object);

            var dfc      = new DataFlowContext(null, serviceProvider);
            var typeName = typeof(CreateTableEntity1).FullName;
            var entity   = new CreateTableEntity1();

            dfc.Add(typeName, entity.GetTableMetadata());
            var items = new ParseResult <CreateTableEntity1>
            {
                entity
            };

            dfc.AddParseData(typeName, items);
            var result = await mongoEntityStorage.HandleAsync(dfc);

            Assert.Equal(DataFlowResult.Success, result);
        }
        public async Task Store_Should_Success()
        {
            var serviceProvider = Mock.Of <IServiceProvider>();

            var mongoCollection = new Mock <IMongoCollection <BsonDocument> >();

            var mongoDatabase = new Mock <IMongoDatabase>();

            mongoDatabase.Setup(d =>
                                d.GetCollection <BsonDocument>(It.IsAny <string>(), It.IsAny <MongoCollectionSettings>()))
            .Returns(mongoCollection.Object);

            var mongoClient = new Mock <IMongoClient>();

            mongoClient.Setup(d => d.GetDatabase(It.IsAny <string>(), It.IsAny <MongoDatabaseSettings>()))
            .Returns(mongoDatabase.Object);

            var mongoEntityStorage = new MongoEntityStorage(mongoClient.Object);

            var tableMetadata = new TableMetadata {
                Schema = new Schema("db", "table")
            };

            var dataFlowContext = new DataFlowContext(serviceProvider);

            dataFlowContext.Add("table", tableMetadata);
            dataFlowContext.AddItem("table", new object[] { new Dictionary <string, object> {
                                                                { "Name", "Value" }
                                                            } });

            var result = await mongoEntityStorage.HandleAsync(dataFlowContext);

            Assert.Equal(DataFlowResult.Success, result);
        }
        public async Task Store_Should_Success()
        {
            var mongoCollection = new Mock <IMongoCollection <BsonDocument> >();

            var mongoDatabase = new Mock <IMongoDatabase>();

            mongoDatabase.Setup(d =>
                                d.GetCollection <BsonDocument>(It.IsAny <string>(), It.IsAny <MongoCollectionSettings>()))
            .Returns(mongoCollection.Object);

            var mongoClient = new Mock <IMongoClient>();

            mongoClient.Setup(d => d.GetDatabase(It.IsAny <string>(), It.IsAny <MongoDatabaseSettings>()))
            .Returns(mongoDatabase.Object);

            var mongoEntityStorage = new MongoEntityStorage(mongoClient.Object);

            var dfc      = new DataContext(null, null, null, null);
            var typeName = typeof(CreateTableEntity1);
            var entity   = new CreateTableEntity1();

            var items = new List <CreateTableEntity1>
            {
                entity
            };

            dfc.AddData(typeName, items);
            await mongoEntityStorage.HandleAsync(dfc);
        }
        public async Task Store_Empty_Should_Success()
        {
            var mongoClient        = new Mock <IMongoClient>();
            var mongoEntityStorage = new MongoEntityStorage(mongoClient.Object);

            var dfc = new DataContext(null, null, null, null);

            mongoEntityStorage.SetLogger(NullLogger.Instance);
            await mongoEntityStorage.HandleAsync(dfc);
        }
        public async Task Store_Empty_Should_Success()
        {
            var serviceProvider    = Mock.Of <IServiceProvider>();
            var mongoClient        = new Mock <IMongoClient>();
            var mongoEntityStorage = new MongoEntityStorage(mongoClient.Object);

            var dataFlowContext = new DataFlowContext(serviceProvider);
            var result          = await mongoEntityStorage.HandleAsync(dataFlowContext);

            Assert.Equal(DataFlowResult.Success, result);
        }
        public async Task Store_Empty_Should_Success()
        {
            var serviceProvider    = Mock.Of <IServiceProvider>();
            var mongoClient        = new Mock <IMongoClient>();
            var mongoEntityStorage = new MongoEntityStorage(mongoClient.Object);

            var dfc      = new DataFlowContext(null, serviceProvider);
            var typeName = typeof(CreateTableEntity1).FullName;
            var entity   = new CreateTableEntity1();

            dfc.Add(typeName, entity.GetTableMetadata());
            var items = new ParseResult <CreateTableEntity1>();

            dfc.AddParseData(typeName, items);

            var result = await mongoEntityStorage.HandleAsync(dfc);

            Assert.Equal(DataFlowResult.Success, result);
        }