public void context_can_get_process_data()
        {
            //arrange
            MatProcessData processData = MatProcessDataHelper.CreateProcessDataObject();
            var            bsonObject  = BsonDocument.Parse(JsonConvert.SerializeObject(processData));

            collection.InsertOne(bsonObject);
            //act
            var context = new MatDbContext(mockOptions.Object);
            var filter  = Builders <BsonDocument> .Filter.Eq("_id", processData.Id);

            var result            = context.getCollection().FindAsync(filter).Result.FirstOrDefault();
            var resultDesirialzie = BsonSerializer.Deserialize <MatProcessData>(result);

            //assert
            Assert.AreEqual(processData.Id, resultDesirialzie.Id);
            Assert.AreEqual(processData.ProcessType.value, resultDesirialzie.ProcessType.value);
            Assert.AreEqual(processData.ProcessType.name, resultDesirialzie.ProcessType.name);
            Assert.AreEqual(processData.DateCreated, resultDesirialzie.DateCreated);
            Assert.AreEqual(processData.DateLastModified, resultDesirialzie.DateLastModified);
            Assert.AreEqual(processData.DateCompleted, resultDesirialzie.DateCompleted);
            Assert.AreEqual(processData.ProcessDataAvailable, resultDesirialzie.ProcessDataAvailable);
            Assert.AreEqual(processData.ProcessDataSchemaVersion, resultDesirialzie.ProcessDataSchemaVersion);
            Assert.AreEqual(processData.ProcessStage, resultDesirialzie.ProcessStage);
            Assert.AreEqual(processData.LinkedProcessId, resultDesirialzie.LinkedProcessId);
            Assert.AreEqual(processData.PreProcessData, resultDesirialzie.PreProcessData);
            Assert.AreEqual(processData.ProcessData, resultDesirialzie.ProcessData);
            Assert.AreEqual(processData.PostProcessData, resultDesirialzie.PostProcessData);
        }
        public void set_up()
        {
            //setting connection options for dbcontext
            var mockOptions = new Mock <IOptions <ConnectionSettings> >();
            //runtime DB connection strings
            var settings = new ConnectionSettings
            {
                ConnectionString = Environment.GetEnvironmentVariable("MONGO_CONN_STRING") ??
                                   @"mongodb://localhost:1433/",
                CollectionName = "process-data",
                Database       = "mat-processes"
            };

            //make options mock return the object with settings
            mockOptions.SetupGet(x => x.Value).Returns(settings);

            //setting up dbcontext
            _dbcontext = new MatDbContext(mockOptions.Object);
            var processDataGateway   = new ProcessDataGateway(_dbcontext);
            var processDataUsecase   = new ProcessDataUseCase(processDataGateway);
            var postInitDocValidator = new PostInitialProcessDocumentRequestValidator();
            var updateDocValidator   = new UpdateProcessDocumentRequestValidator();
            var getDocValidator      = new GetProcessDocumentRequestValidator();
            Mock <ILogger <ProcessDataController> > logger = new Mock <ILogger <ProcessDataController> >();

            _processDataController = new ProcessDataController(processDataUsecase, logger.Object, postInitDocValidator, updateDocValidator, getDocValidator);
        }