Esempio n. 1
0
        public void FairmountvCrundenMartin()
        {
            var buyer        = new CrundenMartin();
            var seller       = new Fairmount();
            var getOrigOffer = buyer.GetCommunication();

            var testSubject = new ComLawContract <Promise>
            {
                Offer      = new TelegramQuote2CurdenMartin(),
                Acceptance = initRequest => initRequest is TelegramQuote2CurdenMartin ? new TelegramAcceptance2Fairmount() : null,
                Assent     = new MutualAssent
                {
                    TermsOfAgreement = lp =>
                    {
                        var isParty = lp is Fairmount ||
                                      lp is FairmountCustomer;
                        if (!isParty)
                        {
                            return(null);
                        }

                        switch (lp)
                        {
                        case Fairmount fairmount:
                            return(fairmount.GetTerms());

                        case FairmountCustomer cust:
                            return(cust.GetTerms());
                        }
                        return(null);
                    },

                    IsApprovalExpressed = lp =>
                    {
                        var fairmountAgrees = (lp as Fairmount)?.GetCommunication(getOrigOffer) != null;
                        var cMartinAgrees   = (lp as CrundenMartin)?.GetCommunication(seller.GetCommunication(getOrigOffer)) != null;
                        return(fairmountAgrees || cMartinAgrees);
                    }
                }
            };

            testSubject.Consideration = new Consideration <Promise>(testSubject)
            {
                IsSoughtByOfferor = (lp, promise) => lp is CrundenMartin && promise is TelegramAcceptance2Fairmount,
                IsGivenByOfferee  = (lp, promise) => lp is Fairmount && promise is TelegramQuote2CurdenMartin,
            };

            var testResult = testSubject.IsValid(new CrundenMartin(), new Fairmount());

            Assert.IsTrue(testResult);
            System.Console.WriteLine(testSubject.ToString());
        }
Esempio n. 2
0
 public override ISet <Term <object> > GetTerms()
 {
     return(TelegramQuote2CurdenMartin.GetTerms());
 }