ToInvestment() 공개 메소드

public ToInvestment ( ) : Investment
리턴 Investment
예제 #1
0
 public void ShouldBeAbleToCreateInvestmentFromOffer()
 {
     var offer = new Offer(
         new Investor(new Name("Investor1"), new Amount(500)), new Amount(300),
         null);
     var investment =
         new Investment(new Investor(new Name("Investor1"), new Amount(500)),
                        null, new Amount(300));
     Assert.AreEqual(investment, offer.ToInvestment());
 }
예제 #2
0
 public void Should_Be_Able_To_Confirm_Subscription()
 {
     Subscription subscription = new Subscription();
     Investor investor0 = new Investor(new Name("Investor0"), new GringottsDate(DateTime.Now), new Amount(100));
     Investor investor1 = new Investor(new Name("Investor1"), new GringottsDate(DateTime.Now), new Amount(100));
     Investor investor2 = new Investor(new Name("Investor2"), new GringottsDate(DateTime.Now), new Amount(100));
     Investor investor3 = new Investor(new Name("Investor3"), new GringottsDate(DateTime.Now), new Amount(100));
     subscription.Add(new Offer(investor0, new Amount(100), null));
     subscription.Add(new Offer(investor1, new Amount(200), null));
     subscription.Add(new Offer(investor2, new Amount(300), null));
     Offer excess = new Offer(investor3, new Amount(400), null);
     subscription.Add(excess);
     Amount outlay = new Amount(600);
     List<Investment> confirmations = subscription.Confirm(outlay);
     Assert.IsFalse(confirmations.Contains(excess.ToInvestment()));
     Assert.AreEqual(outlay, confirmations.Aggregate(new Amount(0), (sum, inv) => sum + inv.Value));
 }
예제 #3
0
 public void Should_Be_Able_To_Create_Investment_From_Offer()
 {
     Offer offer = new Offer(new Investor(new Name("Investor1"), new GringottsDate(DateTime.Now), new Amount(500)), new Amount(300), null);
     Investment investment = new Investment(new Investor(new Name("Investor1"), new GringottsDate(DateTime.Now), new Amount(500)), null, new Amount(300));
     Assert.AreEqual(investment, offer.ToInvestment());
 }
예제 #4
0
        public void SubscriptionConfirmationAcceptsJustTheMinimumSetOfOffers()
        {
            // venture used here just to create the offer. not for adding offers
            var dummyVenture = new Venture(new Name("Ventura"), new Amount(1), new Amount(1));

            var subscription = new Subscription();

            var investor0 = new Investor(new Name("Investor0"),  new Amount(100));
            var investor1 = new Investor(new Name("Investor1"),  new Amount(100));
            var investor2 = new Investor(new Name("Investor2"),  new Amount(100));
            var investor3 = new Investor(new Name("Investor3"),  new Amount(100));

            subscription.Add(new Offer(investor0, new Amount(100), dummyVenture));
            subscription.Add(new Offer(investor1, new Amount(200), dummyVenture));
            subscription.Add(new Offer(investor2, new Amount(300), dummyVenture));
            var excess = new Offer(investor3, new Amount(400), dummyVenture);
            subscription.Add(excess);

            var outlay = new Amount(600);
            List<Investment> confirmations = subscription.Confirm(outlay);
            Assert.IsFalse(confirmations.Contains(excess.ToInvestment()));
            Assert.AreEqual(outlay, confirmations.Aggregate(new Amount(0), (sum, inv) => sum + inv.Value));
        }