fluentassertions / fluentassertions/fluentassertions.datasets

Comparing datatables with dbnull in expectation doesn't cause test to fail when subject has a value

Abierto
#2 9 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
C#
Estrellas
1
Forks
4
Merge medio
8 h 19 min
PR fusionados (30 d)
3

Descripción

### Description

Comparing DataTables where a column in the expectation containing a dbnull value passes comparison regardless of the value in the same column in the subject.

### Complete minimal example reproducing the issue

```csharp
// Arrange
var expected = new DataTable();
expected.Columns.AddRange(new[]
{
new DataColumn("Column1", typeof(string)),
new DataColumn("Column2", typeof(string)),
new DataColumn("Column3", typeof(string))
});

expected.Rows.Add("test", null, "1" );

// Act
var actual = new DataTable();
actual.Columns.AddRange(new[]
{
new DataColumn("Column1", typeof(string)),
new DataColumn("Column2", typeof(string)),
new DataColumn("Column3", typeof(string))
});
actual.Rows.Add("test", "fail", "1");

// Assert
actual.Should().BeEquivalentTo(expected);
```

### Expected behavior:

The test to fail because "Column2" in the expectation is null while it has a value of "fail" in the subject

### Actual behavior:

The test passes. Reversing the order leads to the test failing as expected, i.e.,

```csharp
// Assert
expected.Should().BeEquivalentTo(actual);
```
fails.

### Versions

* Which version of Fluent Assertions are you using? 6.7.0
* Which .NET runtime and version are you targeting? .NET 6

### Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza ejecutando el ejemplo mínimo de DataTable incluido en el issue y compara los dos órdenes de las llamadas a BeEquivalentTo. Sigue la ruta de equivalencia de DataTable desde esa aserción y añade cobertura para un DBNull esperado frente a un valor real; se considera terminado cuando la primera aserción falla de forma consistente, igual que en el caso con el orden invertido.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp
Área
testing
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.