public void WwwAssociatesvGiancontieri() { var testContract = new ComLawContract <Promise> { Offer = new OfferWwwAssociates(), Acceptance = o => o is OfferWwwAssociates ? new AcceptanceWwwAssociates() : null, Assent = new MutualAssent { IsApprovalExpressed = lp => true, TermsOfAgreement = lp => { switch (lp) { case WwwAssociates _: return(((WwwAssociates)lp).GetTerms()); case Giancontieri _: return(((Giancontieri)lp).GetTerms()); default: return(null); } } } }; testContract.Consideration = new Consideration <Promise>(testContract) { IsGivenByOfferee = (lp, p) => true, IsSoughtByOfferor = (lp, p) => true }; var testSubject = new SemanticDilemma <Promise>(testContract) { //since this was present IsPrerequisite = t => t is ExpresslyConditionalTerm, IsIntendedMeaningAtTheTime = t => { // and the contract clear said "either party can cancel" after a specific date var isDateTime = t.RefersTo is DateTime; if (!isDateTime) { return(false); } var tDt = (DateTime)t.RefersTo; return(tDt != DateTime.MaxValue); } }; var testResult = testSubject.IsValid(new WwwAssociates(), new Giancontieri()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }
public void RandomHousvRosettaBooks() { var testContract = new ComLawContract <Promise> { Offer = new OfferSellBooks(), Acceptance = o => o is OfferSellBooks ? new AcceptanceSellBooks() : null, Assent = new MutualAssent { IsApprovalExpressed = lp => true, TermsOfAgreement = lp => { switch (lp) { case AnyAuthorOfBook _: return(((AnyAuthorOfBook)lp).GetTerms()); case RandomHouse _: return(((RandomHouse)lp).GetTerms()); case RosettaBooks _: return(((RosettaBooks)lp).GetTerms()); default: return(null); } } } }; testContract.Consideration = new Consideration <Promise>(testContract) { IsGivenByOfferee = (lp, p) => true, IsSoughtByOfferor = (lp, p) => true }; var testResult = testContract.IsValid(new AnyAuthorOfBook(), new RandomHouse()); Assert.IsTrue(testResult); testResult = testContract.IsValid(new AnyAuthorOfBook(), new RosettaBooks()); Assert.IsTrue(testResult); var testSubject = new SemanticDilemma <Promise>(testContract) { IsIntendedMeaningAtTheTime = IsIntendedMeaning }; testResult = testSubject.IsValid(new AnyAuthorOfBook(), new RandomHouse()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }
public void InReEstateOfSoper() { var testContract = new ComLawContract <Promise> { Offer = new InheritSoperEstate(), Acceptance = o => o is InheritSoperEstate ? new GetsSoperEstate() : null, Assent = new MutualAssent { IsApprovalExpressed = lp => true, TermsOfAgreement = lp => { switch (lp) { case IraSoper _: return(((IraSoper)lp).GetTerms()); case GertrudeWhitby _: return(((GertrudeWhitby)lp).GetTerms()); case AdelineWestphal _: return(((AdelineWestphal)lp).GetTerms()); default: return(null); } } } }; testContract.Consideration = new Consideration <Promise>(testContract) { IsGivenByOfferee = (lp, p) => true, IsSoughtByOfferor = (lp, p) => true }; //although legally his Gertrude is his legal wife - the contract's intend was obviously Adeline var testSubject = new SemanticDilemma <Promise>(testContract) { IsIntendedMeaningAtTheTime = t => t.RefersTo is AdelineWestphal }; var testResult = testSubject.IsValid(new IraSoper(), new GertrudeWhitby()); Assert.IsTrue(testResult); testResult = testSubject.IsValid(new IraSoper(), new AdelineWestphal()); Console.WriteLine(testSubject.ToString()); Assert.IsFalse(testResult); }
public void FigalimentvInternational() { var testContract = new ComLawContract <Promise> { Offer = new OfferSellChicken(), Acceptance = o => o is OfferSellChicken ? new AcceptanceSellChicken() : null, Assent = new MutualAssent { IsApprovalExpressed = lp => true, TermsOfAgreement = lp => { switch (lp) { case Frigaliment _: return(((Frigaliment)lp).GetTerms()); case BnsInternational _: return(((BnsInternational)lp).GetTerms()); default: return(null); } } } }; testContract.Consideration = new Consideration <Promise>(testContract) { IsGivenByOfferee = (lp, p) => true, IsSoughtByOfferor = (lp, p) => true }; var testResult = testContract.IsValid(new Frigaliment(), new BnsInternational()); //this is true any kind of chicken is the "Chicken" type Console.WriteLine(testContract.ToString()); Assert.IsTrue(testResult); var testSubject = new SemanticDilemma <Promise>(testContract) { IsIntendedMeaningAtTheTime = t => t.Name == "chicken" && t.RefersTo is StewingChicken, }; testResult = testSubject.IsValid(new Frigaliment(), new BnsInternational()); Console.WriteLine(testSubject.ToString()); }
public void NanakulivShellOil() { var testContract = new UccContract <Goods> { Offer = new OfferSellBitumen(), Acceptance = o => o is OfferSellBitumen ? new AcceptancePurchaseBitumen() : null, Assent = new Agreement { IsApprovalExpressed = lp => true, TermsOfAgreement = lp => { switch (lp) { case Nanakuli _: return(((Nanakuli)lp).GetTerms()); case ShellOil2 _: return(((ShellOil2)lp).GetTerms()); default: return(null); } } } }; var testResult = testContract.IsValid(new Nanakuli(), new ShellOil2()); Assert.IsTrue(testResult); var testSubject = new SemanticDilemma <Goods>(testContract) { IsIntendedMeaningAtTheTime = t => t.RefersTo is PriceProtection }; testResult = testSubject.IsValid(new Nanakuli(), new ShellOil2()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }