public void Ctor_WithUnknownType() { var target = new InputOutputParameter <Tuple <string> >("@p1"); //Assert target.DbType.Should().Be(DbType.Object); }
public void Ctor_WithName() { var target = new InputOutputParameter <int>("@p1"); //Assert target.Name.Should().Be("@p1"); target.DbType.Should().Be(DbType.Int32); }
public void TransferOutputValueCallsActionPassedInConstructor() { object outVal = null; var toTest = new InputOutputParameter("Foo", o => outVal = o, 42M); toTest.TransferOutputValue("Bar"); outVal.Should().Be("Bar", "it was set by the action passed in the constructor"); }
public void WithValue_IsValid() { var expected = 40; var target = new InputOutputParameter <int>("@in1") .WithValue(expected); //Assert target.Value.Should().Be(expected); }
public void DbTypeInferredWhenNotSet() { var toTest = new InputOutputParameter("Foo", o => { }, 123M); var res = toTest.CreateDbDataParameter(CreateCommand()); res.DbType.Should().Be(DbType.Decimal, "it should have been inferred"); res.ParameterName.Should().Be("Foo", "it was passed in the constructor"); res.Value.Should().Be(123M, "it was passed in the constructor"); res.Direction.Should().Be(ParameterDirection.InputOutput, "it is an input/output parameter"); }
public void SetsConstructorValuesOnParameter() { var toTest = new InputOutputParameter("Foo", o => { }, 123, DbType.Int32, 42, 31, 11); var res = toTest.CreateDbDataParameter(CreateCommand()); res.DbType.Should().Be(DbType.Int32, "it was passed in the constructor"); res.ParameterName.Should().Be("Foo", "it was passed in the constructor"); res.Value.Should().Be(123, "it was passed in the constructor"); res.Size.Should().Be(42, "it was passed in the constructor"); res.Scale.Should().Be(31, "it was passed in the constructor"); res.Precision.Should().Be(11, "it was passed in the constructor"); res.Direction.Should().Be(ParameterDirection.InputOutput, "it is an input/output parameter"); }