Ejemplo n.º 1
0
        public void HarrahsvHnedakBobo()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferDesignDockingFacility(),
                Acceptance = o => o is OfferDesignDockingFacility ? new AcceptanctDesignDockingFacility() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case Harrahs _:
                            return(((Harrahs)lp).GetTerms());

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

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

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

            var testResult = testContract.IsValid(new Harrahs(), new HnedakBobo());

            Assert.IsTrue(testResult);

            var testSubject = new Expectation <Promise>(testContract)
            {
                CalcLossToInjured = lp => 100m
            };

            //this is what HBG wanted summary judgement of
            testSubject.Limits.CalcUnforeseeable = lp => 100m;

            testResult = testSubject.IsValid(new Harrahs(), new HnedakBobo());
            Console.WriteLine(testSubject.ToString());
            Assert.IsFalse(testResult);
        }
Ejemplo n.º 2
0
        public void KayAndersonvAmeritech()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferYellowPagesListing(),
                Acceptance = o => o is OfferYellowPagesListing ? new AcceptanctYellowPagesListing() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case KayAnderson _:
                            return(((KayAnderson)lp).GetTerms());

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

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

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

            var testResult = testContract.IsValid(new KayAnderson(), new Ameritech());

            Assert.IsTrue(testResult);

            var testSubject = new Expectation <Promise>(testContract)
            {
                CalcLossToInjured = lp => lp is KayAnderson ? 183000m : 0m
            };

            //the defendant wanted something like this - they failed
            testSubject.Limits.CalcUncertainty = lp => lp is KayAnderson ? 165000 : 0m;

            testResult = testSubject.IsValid(new KayAnderson(), new Ameritech());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
Ejemplo n.º 3
0
        public void ParkervTwentiethFox()
        {
            var testContract = new ComLawContract<Promise>
            {
                Offer = new OfferPayActress(),
                Acceptance = o => o is OfferPayActress ? new AcceptanctPayActress() : null,
                Assent = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement = lp =>
                    {
                        switch (lp)
                        {
                            case Parker _:
                                return ((Parker)lp).GetTerms();
                            case TwentiethFox _:
                                return ((TwentiethFox)lp).GetTerms();
                            default:
                                return null;
                        }
                    }
                }
            };

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

            var testResult = testContract.IsValid(new Parker(), new TwentiethFox());
            Assert.IsTrue(testResult);

            var testSubject = new Expectation<Promise>(testContract)
            {
                CalcLossToInjured = lp => lp is Parker ? 750000m : 0
            };

            //this is what the dissenting judge noted, 
            // seems like speculation to apply value judgements about anything other than money
            testSubject.Limits.CalcUncertainty = lp => lp is Parker ? 749999m : 0;

            testResult = testSubject.IsValid(new Parker(), new TwentiethFox());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);

        }
Ejemplo n.º 4
0
        public void RockinghamvLutenBridge()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferCtorBridge(),
                Acceptance = o => o is OfferCtorBridge ? new AcceptanctCtorBridge() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case Rockingham _:
                            return(((Rockingham)lp).GetTerms());

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

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

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

            var testResult = testContract.IsValid(new Rockingham(), new LutenBridge());

            Assert.IsTrue(testResult);

            var testSubject = new Expectation <Promise>(testContract)
            {
                //Luten Bridge kept building a useless bridge after being told not to
                CalcLossToInjured = lp => 100m
            };

            testSubject.Limits.CalcAvoidable = lp => 50m;
            testResult = testSubject.IsValid(new Rockingham(), new LutenBridge());
            Assert.IsTrue(testResult);
            Console.WriteLine(testSubject.ToString());
        }
Ejemplo n.º 5
0
        public void LeingangvCityOfMandan()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferTrimLargeLots(),
                Acceptance = o => o is OfferTrimLargeLots ? new AcceptanctTrimLargeLots() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case Leingang _:
                            return(((Leingang)lp).GetTerms());

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

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

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

            var testResult = testContract.IsValid(new Leingang(), new CityOfMandan());

            Assert.IsTrue(testResult);

            var testSubject = new Expectation <Promise>(testContract)
            {
                CalcLossAvoided   = lp => lp is Leingang ? 211.18m : 0m,
                CalcLossToInjured = lp => lp is Leingang ? 1933.78m : 0m,
            };

            testResult = testSubject.IsValid(new Leingang(), new CityOfMandan());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
Ejemplo n.º 6
0
        public void HawkinsvMcGee()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferSkinGraft(),
                Acceptance = o => o is OfferSkinGraft ? new AcceptanctSkinGraft() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case Hawkins _:
                            return(((Hawkins)lp).GetTerms());

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

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

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

            var testResult = testContract.IsValid(new Hawkins(), new McGee());

            Assert.IsTrue(testResult);

            var testSubject = new Expectation <Promise>(testContract)
            {
                CalcLossToInjured = lp => lp is Hawkins ? 500m : 0m,
            };

            testResult = testSubject.IsValid(new Hawkins(), new McGee());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }
        public void UsNavalInstitutevCharterComm()
        {
            var testContract = new ComLawContract <Promise>
            {
                Offer      = new OfferSellPaperBack(),
                Acceptance = o => o is OfferSellPaperBack ? new AcceptanctSellPaperBack() : null,
                Assent     = new MutualAssent
                {
                    IsApprovalExpressed = lp => true,
                    TermsOfAgreement    = lp =>
                    {
                        switch (lp)
                        {
                        case UsNavalInstitute _:
                            return(((UsNavalInstitute)lp).GetTerms());

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

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

            testContract.Consideration = new Consideration <Promise>(testContract)
            {
                IsGivenByOfferee  = (lp, p) => true,
                IsSoughtByOfferor = (lp, p) => true
            };
            var testResult = testContract.IsValid(new UsNavalInstitute(), new CharterComm());

            Assert.IsTrue(testResult);

            var testSubject = new Expectation <Promise>(testContract)
            {
                CalcLossToInjured = lp => lp is UsNavalInstitute ? 15000m : 0m
            };

            testResult = testSubject.IsValid(new UsNavalInstitute(), new CharterComm());
            Console.WriteLine(testSubject.ToString());
            Assert.IsTrue(testResult);
        }