Quantcast
Channel: Fluent Assertions
Viewing all articles
Browse latest Browse all 1402

Commented Issue: Support interface inheritance with AllProperties [11840]

$
0
0
public class Car: Vehicle, ICar
{
public int Wheels { get; set; }
}

public class Vehicle : IVehicle
{
public int VehicleId { get; set; }
}

public interface ICar : IVehicle
{
int Wheels { get; set; }
}

public interface IVehicle
{
int VehicleId { get; set; }
}

[TestMethod]
public void Should()
{
var expected = (ICar)new Car {VehicleId = 99999, Wheels = 4};
var actual = (ICar)new Car {VehicleId = 1, Wheels = 4};
actual.ShouldHave().AllProperties().EqualTo(expected);
// this assert passes but should fail on VehicleId
}

[TestMethod]
public void Should()
{
var expected = (IVehicle)new Car {VehicleId = 1, Wheels = 4};
var actual = (IVehicle)new Car {VehicleId = 1, Wheels = 99999};
actual.ShouldHave().AllProperties().EqualTo(expected);
// this assert passes but should fail on Wheels
}
Comments: ** Comment from web user: brianlow **

I understand.


Viewing all articles
Browse latest Browse all 1402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>