public void SubmitParcelIntoBL_ShouldReturnThrowExeption_WhenValidationFailed() { parcel.TrackingId = "X"; BLException exc = Assert.Throws <BLException>(() => _controller.SubmitParcelIntoBL(parcel)); Assert.AreEqual($"BL: Parcel Validation failed", exc.InnerException.Message); }
public void ReportDeliveryFinal_ShouldReturnDALExceptopn_WhenNotFailsInBL() { string trackingId = "FALSCH"; _mock.Setup(x => x.GetByTrackingID(trackingId)).Throws(new Exception("Err")); BLException exc = Assert.Throws <BLException>(() => _controller.ReportDeliveryFinal(trackingId)); StringAssert.StartsWith("Err", exc.InnerException.Message); }
public void TrackPackage_ShouldReturnException_WhenNOTSucceedsInDAL() { string trackingId = "ABCDEF123"; _mock.Setup(x => x.GetByTrackingID(trackingId)).Throws(new DAL.DALException("Err")); BLException exc = Assert.Throws <BLException>(() => _controller.TrackPackage(trackingId)); StringAssert.StartsWith("Err", exc.InnerException.Message); }
public void StaffReportHop_ShouldReturnBLExceptopn_WhenNotFailsInBL() { string trackingId = "FALSCH"; string code = "FALSCH"; _mock.Setup(x => x.GetByTrackingID(trackingId)).Throws(new Exception("Err")); BLException exc = Assert.Throws <BLException>(() => _controller.StaffReportHop(trackingId, code)); StringAssert.StartsWith("Err", exc.InnerException.Message); }
public void TransferParcelPartner_ShouldReturnNull_WhenNOTSucceedsInDAL() { string newtrackingId = "FALSCH"; string oldtrackingId = "FALSCH"; _mock.Setup(x => x.GetByTrackingID(newtrackingId)).Throws(new DAL.DALException("hi")); _mock.Setup(x => x.Update(It.IsAny <DAL.Parcel>())); BLException exc = Assert.Throws <BLException>(() => _controller.TransferParcelPartner(newtrackingId, oldtrackingId)); Assert.AreEqual($"hi", exc.InnerException.Message); }
public void TrackPackage_ShouldReturnException_WhenNOTSucceeds() { string trackingId = "ABCDEF123"; DAL.Parcel p = new DAL.Parcel() { TrackingId = "ABCDEF123" }; _mock.Setup(x => x.GetByTrackingID(trackingId)).Throws(new Exception("HINIG")); BLException exc = Assert.Throws <BLException>(() => _controller.TrackPackage(trackingId)); Assert.AreEqual("HINIG", exc.InnerException.Message); }
/// <summary> /// Creates new instance of exception /// </summary> /// <param name="exception">Exception which caused result code 400</param> public BadRequestException(BLException exception) : base(exception?.Message) { }