public void TruckRentvPuritanFarms() { var testContract = new ComLawContract <Promise> { Offer = new OfferRentTrucks(), Acceptance = o => o is OfferRentTrucks ? new AcceptanctRentTrucks() : null, Assent = new MutualAssent { IsApprovalExpressed = lp => true, TermsOfAgreement = lp => { switch (lp) { case TruckRent _: return(((TruckRent)lp).GetTerms()); case PuritanFarms _: return(((PuritanFarms)lp).GetTerms()); default: return(null); } } } }; testContract.Consideration = new Consideration <Promise>(testContract) { IsGivenByOfferee = (lp, p) => true, IsSoughtByOfferor = (lp, p) => true }; var testResult = testContract.IsValid(new TruckRent(), new PuritanFarms()); Assert.IsTrue(testResult); var testSubject = new LiquidatedDmg <Promise>(testContract) { //court found this is reasonable IsDisproportionateToActual = lp => !(lp is TruckRent || lp is PuritanFarms) }; testResult = testSubject.IsValid(new TruckRent(), new PuritanFarms()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }
public void LakeRivervCarborundum() { var testContract = new ComLawContract <Promise> { Offer = new OfferProvideDistribution(), Acceptance = o => o is OfferProvideDistribution ? new AcceptanctProvideDistribution() : null, Assent = new MutualAssent { IsApprovalExpressed = lp => true, TermsOfAgreement = lp => { switch (lp) { case LakeRiver _: return(((LakeRiver)lp).GetTerms()); case Carborundum _: return(((Carborundum)lp).GetTerms()); default: return(null); } } } }; testContract.Consideration = new Consideration <Promise>(testContract) { IsGivenByOfferee = (lp, p) => true, IsSoughtByOfferor = (lp, p) => true }; var testResult = testContract.IsValid(new LakeRiver(), new Carborundum()); Assert.IsTrue(testResult); var testSubject = new LiquidatedDmg <Promise>(testContract) { IsDisproportionateToActual = lp => lp is LakeRiver }; testResult = testSubject.IsValid(new LakeRiver(), new Carborundum()); Console.WriteLine(testSubject.ToString()); Assert.IsFalse(testResult); }