Exemple #1
0
        public void TownFairfieldvDaddario()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferConstructSewerageSystem(),
                Acceptance = o => o is OfferConstructSewerageSystem ? new AcceptanceConstructSewerageSystem() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case TownFairfield _:
                            return(((TownFairfield)lp).GetTerms());

                        case Daddario _:
                            return(((Daddario)lp).GetTerms());

                        default:
                            return(null);
                        }
                    }
                }
            };

            testContract.Consideration = new Consideration <Promise>(testContract)
            {
                IsGivenByOfferee  = (lp, p) => true,
                IsSoughtByOfferor = (lp, p) => true
            };

            var testSubject = new ConditionsPrecedent <Promise>(testContract)
            {
                IsConditionalTerm = t => t.Name == "notice",
                IsNotConditionMet = (t, lp) =>
                {
                    if (t.Name == "notice" && lp is TownFairfield)
                    {
                        return(false);
                    }
                    return(true);
                }
            };

            var testResult = testSubject.IsValid(new TownFairfield(), new Daddario());

            Console.WriteLine(testResult.ToString());
            Assert.IsFalse(testResult);
        }
Exemple #2
0
        public void AcmeMarketsvFedArmored()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferTransportCashToBank(),
                Acceptance = o => o is OfferTransportCashToBank ? new AcceptanceTransportCashToBank() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case AcmeMarket _:
                            return(((AcmeMarket)lp).GetTerms());

                        case FedArmored _:
                            return(((FedArmored)lp).GetTerms());

                        default:
                            return(null);
                        }
                    }
                }
            };

            testContract.Consideration = new Consideration <Promise>(testContract)
            {
                IsGivenByOfferee  = (lp, p) => true,
                IsSoughtByOfferor = (lp, p) => true
            };

            var testSubject = new ConditionsPrecedent <Promise>(testContract)
            {
                IsConditionalTerm = t => t.Name == "receipted",
                IsNotConditionMet = (t, lp) => true
            };

            var testResult = testSubject.IsValid(new AcmeMarket(), new FedArmored());

            Console.WriteLine(testSubject);
            Assert.IsFalse(testResult);
        }
Exemple #3
0
        public void NorthHoustonvPwRealEstate()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferRefinMortgage(),
                Acceptance = o => o is OfferRefinMortgage ? new AcceptanceRefinMortgage() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case NorthHouston _:
                            return(((NorthHouston)lp).GetTerms());

                        case PwRealEstate _:
                            return(((PwRealEstate)lp).GetTerms());

                        default:
                            return(null);
                        }
                    }
                }
            };

            testContract.Consideration = new Consideration <Promise>(testContract)
            {
                IsGivenByOfferee  = (lp, p) => true,
                IsSoughtByOfferor = (lp, p) => true
            };

            var testSubject = new ConditionsPrecedent <Promise>(testContract)
            {
                IsConditionalTerm = t => t.Name == "estoppel certificate",
                IsNotConditionMet = (t, lp) =>
                {
                    var isParty = lp is NorthHouston;
                    if (!isParty)
                    {
                        return(false);
                    }
                    var isTerm = t.Name == "estoppel certificate";
                    if (!isTerm)
                    {
                        return(false);
                    }

                    //they failed to meet this requirement
                    if (isTerm && isParty)
                    {
                        return(true);
                    }
                    return(false);
                }
            };

            var testResult = testSubject.IsValid(new NorthHouston(), new PwRealEstate());

            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }
Exemple #4
0
        public void ClarkvWest()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferWriteLawDox(),
                Acceptance = o => o is OfferWriteLawDox ? new AcceptanceWriteLawDox() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case Clark _:
                            return(((Clark)lp).GetTerms());

                        case West _:
                            return(((West)lp).GetTerms());

                        default:
                            return(null);
                        }
                    }
                }
            };

            testContract.Consideration = new Consideration <Promise>(testContract)
            {
                IsGivenByOfferee  = (lp, p) => true,
                IsSoughtByOfferor = (lp, p) => true
            };

            var testSubject = new ConditionsPrecedent <Promise>(testContract)
            {
                IsConditionalTerm = t => t.Name.StartsWith("abstain from"),
                IsNotConditionMet = (t, lp) =>
                {
                    var isParty = lp is West;
                    if (!isParty)
                    {
                        return(false);
                    }
                    var isTerm = t.Name.StartsWith("abstain from");
                    if (!isTerm)
                    {
                        return(false);
                    }

                    //they failed to meet this requirement
                    if (isTerm && isParty)
                    {
                        return(true);
                    }
                    return(false);
                }
            };

            var testResult = testSubject.IsValid(new Clark(), new West());

            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }