Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Theater example!");

            // Create tickets and ready to set up theater with ticket office, ticket seller
            Ticket[] tickets = new Ticket[50];
            for (int i = 0; i < 50; i++)
            {
                tickets[i] = new Ticket();
            }
            TicketSeller ticketSeller = new TicketSeller(new TicketOffice(1000000, tickets));

            // Create five audiences with bags
            // Three bags has no invitation
            // Two bags has invitation
            Audience jisoo  = new Audience(new Bag(20000));
            Audience rose   = new Audience(new Bag(30000));
            Audience lisa   = new Audience(new Bag(60000));
            Audience jennie = new Audience(new Bag(new Invitation(), 30));
            Audience feel   = new Audience(new Bag(new Invitation(), 40));

            // Audience enter to theater
            Theater1 theater = new Theater1(ticketSeller);

            theater.Enter(jisoo);
            theater.Enter(rose);
            theater.Enter(lisa);
            theater.Enter(jennie);
            theater.Enter(feel);
        }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            var factStoreDirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TicketSeller");
            var typesProvider = new AssemblyScanningTypesProvider(new[] {typeof (Program).Assembly});
            var diskFactStore = new DiskFactStore(factStoreDirectoryPath, typesProvider);

            var sqlFactStore = SqlServerFactStore.Create(@"Server=.\SQLEXPRESS;Database=TicketSeller;Trusted_Connection=True;", typesProvider);

            _sourcererFactory = SourcererConfigurator.Configure()
                //.With(c => c.FactStore = new MemoryFactStore())
                //.With(c => c.FactStore = diskFactStore)
                                                     .With(c => c.FactStore = sqlFactStore)
                                                     .Abracadabra();

            var ticketSeller = new TicketSeller();
            ticketSeller.SellABunchOfTickets();

            Directory.Delete(factStoreDirectoryPath);
        }
Esempio n. 3
0
        public void TestMethod1()
        {
            // Arrange
            Ticket[] tickets = new Ticket[50];
            for (int i = 0; i < 50; i++)
            {
                tickets[i] = new Ticket();
            }

            int          officeProperty = 1000000;
            TicketOffice ticketOffice   = new TicketOffice(1000000, tickets);
            TicketSeller ticketSeller   = new TicketSeller(ticketOffice);
            Theater1     theater        = new Theater1(ticketSeller);

            int      audienceCash = 20000;
            Bag      bag          = new Bag(audienceCash);
            Audience jisoo        = new Audience(bag);

            // Act
            theater.Enter(jisoo);

            // Assert
            Assert.AreEqual(officeProperty + audienceCash, ticketOffice.Amount + jisoo.Amount);
        }
Esempio n. 4
0
 public Theater1(TicketSeller ticketSeller) => this.ticketSeller = ticketSeller;