Skip to content

Commit

Permalink
better naming for convert operation (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
runeanielsen committed Jan 3, 2022
1 parent 369b10f commit de2c5c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/MsSqlCdc/DataConvert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool isDefaultCdcField(string fieldName) =>
(byte[])columnFields.First(x => x.fieldName == CdcFieldName.StartLsn).fieldValue);
var seqVal = ConvertBinaryLsn(
(byte[])columnFields.First(x => x.fieldName == CdcFieldName.SeqVal).fieldValue);
var operation = ConvertIntOperation(
var operation = ConvertOperation(
(int)columnFields.First(x => x.fieldName == CdcFieldName.Operation).fieldValue);
var updateMask = Encoding.UTF8.GetString(
(byte[])columnFields.First(x => x.fieldName == CdcFieldName.UpdateMask).fieldValue);
Expand Down Expand Up @@ -69,7 +69,7 @@ public static long ConvertBinaryLsn(byte[] bytes) => BitConverter.IsLittleEndian
/// <param name="representation">The number representation of the Operation.</param>
/// <returns>Enum representation of the number representation.</returns>
/// <exception cref="ArgumentException"></exception>
public static Operation ConvertIntOperation(int representation)
public static Operation ConvertOperation(int representation)
=> representation switch
{
1 => Operation.Delete,
Expand Down
4 changes: 2 additions & 2 deletions test/MsSqlCdc.Tests/DataConvertTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public void Conversion_cdc_column_without_default_fields_is_invalid(
[InlineData(4, Operation.AfterUpdate)]
public void Operation_valid_number_representation_should_be_converted(int input, Operation expected)
{
var operation = DataConvert.ConvertIntOperation(input);
var operation = DataConvert.ConvertOperation(input);
operation.Should().Be(expected);
}

Expand All @@ -303,7 +303,7 @@ public void Operation_valid_number_representation_should_be_converted(int input,
[InlineData(int.MaxValue)]
public void Operation_invalid_number_representation_should_not_be_converted(int input)
{
Invoking(() => DataConvert.ConvertIntOperation(input)).Should().Throw<ArgumentException>();
Invoking(() => DataConvert.ConvertOperation(input)).Should().Throw<ArgumentException>();
}

[Theory]
Expand Down

0 comments on commit de2c5c1

Please sign in to comment.