public void GetBooleanValue_NullOrInvalidType_ReturnsNull(string str)
        {
            var metadataBoolean = new MetadataOracleBoolean();

            Assert.Null(metadataBoolean.GetBooleanValue(str));
            Assert.Null(metadataBoolean.GetBooleanValue(null));
        }
        public void CreateBooleanMetadata()
        {
            var metadataFactory = new MetadataFactory();

            MetadataOracleBoolean actual = metadataFactory.CreateBoolean();

            Assert.NotNull(actual);
        }
        public void GetDeclareLine_Works(string parameterName)
        {
            var metadataBoolean = new MetadataOracleBoolean();

            var actual = metadataBoolean.GetDeclareLine(parameterName);

            Assert.Equal($"{parameterName} boolean;", actual);
        }
예제 #4
0
        internal void GetBodyVariableSetString_FalseValue(MetadataOracleBoolean metadata, string name, ParameterDirection direction)
        {
            var param = new ParamBoolean(false, direction, metadata);

            param.SetParameterName(name);

            var actual = param.GetBodyVariableSetString();

            Assert.Equal($"{name} := false;", actual);
        }
        public void GetBooleanValue_Works(bool value)
        {
            var parameter       = new OracleDecimal(value ? 1 : 0);
            var metadataBoolean = new MetadataOracleBoolean();

            var actual = metadataBoolean.GetBooleanValue(parameter);

            Assert.NotNull(actual);
            Assert.IsType <bool>(actual);
        }
        public void GetOracleParameter_Works(bool?expected, int counter)
        {
            var metadataBoolean = new MetadataOracleBoolean();

            var actual = metadataBoolean.GetOracleParameter(expected, counter);

            Assert.NotNull(actual);
            Assert.Equal($":{counter}", actual.ParameterName);
            Assert.Equal(expected.HasValue ? Convert.ToByte(expected.Value) : (byte?)null, actual.Value);
        }
예제 #7
0
        private AdditionalInformation ReturnValueAdditionalInformationBoolean <T>(ExecutionInformation info,
                                                                                  MetadataOracleBoolean metadata, out OracleParameter parameter)
        {
            parameter = FunctionReturnOracleParameter <T>(info, metadata);
            var name = "ret";

            return(new AdditionalInformation
            {
                Declare = metadata.GetDeclareLine(name),
                Output = metadata.OutputString(info.ParameterCounter, name)
            });
        }
        public void OutputString_Works(int startNumber, string fieldName)
        {
            var metadataBoolean = new MetadataOracleBoolean();

            var actual = metadataBoolean.OutputString(startNumber, fieldName);

            Assert.Equal($@"
                if({fieldName}) then
                    :{startNumber} := 1;
                else
                    :{startNumber} := 0;
                end if;", actual);
        }
예제 #9
0
        internal void Constructor_TwoParameter(bool?value, ParameterDirection direction, MetadataOracleBoolean metadata)
        {
            var param = new ParamBoolean(value, direction, metadata);

            Assert.Equal(value, param.Value);
            Assert.Equal(direction, param.Direction);
            Assert.Equal(metadata, param.Metadata);
        }
        public void OutputString_ThrowsNullArgument()
        {
            var metadataBoolean = new MetadataOracleBoolean();

            Assert.Throws <ArgumentNullException>("fieldName", () => metadataBoolean.OutputString(0, null));
        }
        public void GetDeclareLine_ThrowsNullArgument()
        {
            var metadataBoolean = new MetadataOracleBoolean();

            Assert.Throws <ArgumentNullException>("parameterName", () => metadataBoolean.GetDeclareLine(null));
        }
 internal ParamBoolean(bool?value, ParameterDirection direction, MetadataOracleBoolean metadata)
     : base(typeof(bool?), value, direction)
 {
     Value    = value;
     Metadata = metadata;
 }