Beispiel #1
0
        public void TestNoDate()
        {
            String s =
                "Headcount, 250, "
                + "City, Springfield, DollarsPerHead, 9.95, "
                + "HasSite, false";
            ReservationBuilder b = new ForgivingBuilder();

            new ReservationParser(b).Parse(s);
            Reservation r = b.Build();// powinien zwróciæ wyj¹tek
        }
Beispiel #2
0
        public void TestNoCity()
        {
            String s =
                "Date, November 5, Headcount, 250, "
                + "DollarsPerHead, 9.95, "
                + "HasSite, false";
            ReservationBuilder b = new ForgivingBuilder();

            new ReservationParser(b).Parse(s);
            Reservation r = b.Build();// powinien zwróciæ wyj¹tek
        }
Beispiel #3
0
        //[ExpectedException(typeof(BuilderException))]
        public void TestNoDate()
        {
            String s =
                "Headcount, 250, "
                + "City, Springfield, DollarsPerHead, 9.95, "
                + "HasSite, false";
            ReservationBuilder b = new ForgivingBuilder();

            new ReservationParser(b).Parse(s);
            //    Reservation r = b.Build();// should throw an exception
            Assert.Throws <BuilderException>(() => b.Build());
        }
Beispiel #4
0
        /// <summary>
        /// Test dzia³ania dla przypadku, gdy jest iloœæ widzów, ale nie ma
        /// ceny od osoby. Cena od osoby powinna byæ ustawiona na wartoœæ
        /// gwarantuj¹c¹ minimalny przychód.
        /// </summary>
        public void TestNoDollar()
        {
            String s =
                "Date, November 5, Headcount, 250, City, Springfield, "
                + "  HasSite, false";
            ForgivingBuilder  b = new ForgivingBuilder();
            ReservationParser p = new ReservationParser(b);

            p.Parse(s);
            Reservation r = b.Build();
            //
            DateTime d = new DateTime(2000, 11, 5);

            d = ReservationBuilder.Futurize(d);
            //
            Assertion.AssertEquals(d, r.Date);
            Assertion.AssertEquals(250, r.Headcount);
            Assertion.Assert(r.Headcount * r.DollarsPerHead >= ReservationBuilder.MINTOTAL);
            Assertion.AssertEquals("Springfield", r.City);
            Assertion.AssertEquals(false, r.HasSite);
        }
Beispiel #5
0
        public void TestNormal()
        {
            String s =
                "Date, November 5, Headcount, 250, City, Springfield, "
                + "DollarsPerHead, 9.95, HasSite, false";
            ForgivingBuilder  b = new ForgivingBuilder();
            ReservationParser p = new ReservationParser(b);

            p.Parse(s);
            Reservation r = b.Build();
            //
            DateTime d = new DateTime(2000, 11, 5);

            d = ReservationBuilder.Futurize(d);
            //
            Assert.AreEqual(d, r.Date);
            Assert.AreEqual(250, r.Headcount);
            Assert.AreEqual("Springfield", r.City);
            Assert.AreEqual(9.95, (double)r.DollarsPerHead, .01);
            Assert.AreEqual(false, r.HasSite);
        }