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 **
{
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.