public void OnAfterSetData_IfContextDbRecorderContext_ReturnDo()
        {
            //Arrange
            DbRecorderContext context = new OracleRecorderContext();
            context.Record = new RecWrapper();
            context.ContextKeys.Add("QUERY_EXT","lorem");
            context.ContextVariables.Add("lorem","ipsum");
            var externalVariables = new Dictionary<string, string> { { "@RECORDNUM_lorem", "val1" }, { "@RECORDDATE_lorem", "val2" } };

            //Act
            FieldTestHelper.SetInstanceFieldValue("externalVariables", _dbRecorderBase, externalVariables);
            //Act
            // ReSharper disable ExpressionIsAlwaysNull
            var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, NextInstruction>("OnAfterSetData", _dbRecorderBase, new object[] { context });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            Assert.AreEqual(actual, NextInstruction.Do);
        }
        public void InitContextGlobals_IfContextKeysHasNoElements_KeyNotFoundException()
        {
            //Arrange
            DbRecorderContext dbContext = new OracleRecorderContext();
            string host = null;
            const int port = 0;

            //Act
            // ReSharper disable ExpressionIsAlwaysNull
            MethodTestHelper.RunInstanceMethod<DbRecorderBase>("InitContextGlobals", _dbRecorderBase, new object[] { dbContext, host, port });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            //Unhandled KeyNotFoundException
        }
        public void Object2Property_Ifdata0IsDbRecorderContextIsNull_ReturnData2()
        {
            //Arrange
            var textProperty = new TextProperty();

            RecWrapper rec = null;
            var field = string.Empty;
            string[] fieldValues = null;

            var array1 = new object[5];
            array1[0] = new OracleRecorderContext();
            array1[1] = FieldTestHelper.GetInstanceFieldValue("PropertyInfo", textProperty);
            array1[2] = "String literal";
            array1[3] = 3;
            array1[4] = null;

            object data = array1;

            //Act

            // ReSharper disable ExpressionIsAlwaysNull
            var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, object>("Object2Property", _dbRecorderBase, new[] { rec, field, fieldValues, data });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            Assert.AreEqual(actual, "String literal");
        }
        public void GetHeaderInfo_IfReadersIsNull_ReturnDo()
        {
            //Arrange
            DbRecorderContext context = new OracleRecorderContext();
            context.Readers.Add("DATA_READER", null);
            context.ContextKeys.Add("DATA_READER", "DATA_READER");
            Exception error = null;

            //Act
            // ReSharper disable ExpressionIsAlwaysNull
            var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, NextInstruction>("GetHeaderInfo", _dbRecorderBase, new object[] { context, error });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            Assert.AreEqual(actual, NextInstruction.Do);
        }
        public void InitActiveParameters_IfContextVariablesHasNoElements_KeyNotFoundException()
        {
            //Arrange
            DbRecorderContext dbContext = new OracleRecorderContext();
            dbContext.ContextKeys.Add("QUERY", "QUERY");
            var query = string.Empty;
            var queryExtension = string.Empty;
            var queryString = string.Empty;

            //Act
            // ReSharper disable ExpressionIsAlwaysNull
            MethodTestHelper.RunInstanceMethod<DbRecorderBase>("InitActiveParameters", _dbRecorderBase, new object[] { dbContext, query, queryExtension, queryString });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            //Unhandled KeyNotFoundException
        }
        public void GetHeaderInfo_IfHeaderInfoIsNotNull_ReturnDo()
        {
            //Arrange
            RecorderContext context = new OracleRecorderContext();
            context.HeaderInfo = new DataMappingInfo();
            Exception error = null;

            //Act
            // ReSharper disable ExpressionIsAlwaysNull
            var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, NextInstruction>("GetHeaderInfo", _dbRecorderBase, new object[] { context, error });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            Assert.AreEqual(actual, NextInstruction.Do);
        }
        public void GetHeaderInfo_IfAllParametersTrue_ReturnDo()
        {
            //Arrange
            DbRecorderContext context = new OracleRecorderContext();
            var table = new DataTable();
            table.Columns.Add("Patient", typeof(string));
            DbDataReader reader = new DataTableReader(table);
            context.Readers.Add("DATA_READER", reader);
            context.ContextKeys.Add("DATA_READER", "DATA_READER");
            Exception error = null;

            //Act
            // ReSharper disable ExpressionIsAlwaysNull
            var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, NextInstruction>("GetHeaderInfo", _dbRecorderBase, new object[] { context, error });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            Assert.AreEqual(actual, NextInstruction.Do);
        }
        public void DisposeActiveData_IfdbContextKeysHasNoElements_ReturnFalse()
        {
            //Arrange
            DbRecorderContext dbContext = new OracleRecorderContext();

            //Act

            // ReSharper disable ExpressionIsAlwaysNull
            var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, bool>("DisposeActiveData", _dbRecorderBase, new object[] { dbContext });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            Assert.IsFalse(actual);
        }
        public void DisposeActiveData_IfdbContextKeysHasElements_ReturnTrue()
        {
            //Arrange
            DbRecorderContext dbContext = new OracleRecorderContext();
            dbContext.ContextKeys.Add("DATA_READER", "DATA_READER");
            dbContext.ContextKeys.Add("COMMAND", "COMMAND");
            dbContext.ContextKeys.Add("CONNECTION", "CONNECTION");

            //Act

            // ReSharper disable ExpressionIsAlwaysNull
            var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, bool>("DisposeActiveData", _dbRecorderBase, new object[] { dbContext });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            Assert.IsTrue(actual);
        }
        public void Value2External_IfTrueInput_ReturnNull()
        {
            //Arrange
            RecWrapper rec = null;
            string field = null;
            string[] fieldValues = null;
            var context = new OracleRecorderContext { ExternalVariables = new Dictionary<string, string>() };
            context.ExternalVariables.Add("@99",null);
            var array1 = new object[5];
            array1[0] = context;
            array1[1] = 99;
            array1[2] = "String literal";
            array1[3] = null;

            object data = array1;

            //Act
            // ReSharper disable ExpressionIsAlwaysNull
            var actual = MethodTestHelper.RunInstanceMethod<DbRecorderBase, object>("Value2External", _dbRecorderBase, new[] { rec, field, fieldValues, data });
            // ReSharper restore ExpressionIsAlwaysNull

            //Assert
            Assert.AreEqual(actual, null);
        }