Esempio n. 1
0
        public void TestRouteListSubject()
        {
            RouteList    routes    = new RouteList();
            MockObserver observer1 = new MockObserver();
            MockObserver observer2 = new MockObserver();

            WriteToBinaryFile <List <Ticket> >(@"Berlin_tickets.txt", new List <Ticket>(), false);
            WriteToBinaryFile <List <Ticket> >(@"Paris_tickets.txt", new List <Ticket>(), false);

            Station Berlin      = new Station("Berlin");
            Station Paris       = new Station("Paris");
            Route   BerlinParis = new Route(Berlin, Paris, 1234.00m);

            routes.RegisterObserver(observer1);
            routes.RegisterObserver(observer2);

            routes.AddRoute(BerlinParis);

            Assert.IsTrue(observer1.GetRoutes() == routes.GetAllRoutes());
            Assert.IsTrue(observer2.GetRoutes() == routes.GetAllRoutes());

            File.Delete(@"Berlin_tickets.txt");
        }