public void Test_Save_Truck() { IDispatchManager dm = new DispatchManager(); Truck truck = new Truck() { Id = 7, TruckName = "Truck Name is not null " }; var rs = dm.SaveTruck(truck); Assert.IsTrue(rs.Ok); truck = null; rs = dm.SaveTruck(truck); Assert.IsTrue((!rs.Ok) && rs.Errors.Contains("truck can not be null")); truck = new Truck() { }; Assert.IsFalse(rs.Ok && rs.Errors.Contains("Truck name is required!")); }