Exemple #1
0
        public void TestTabletHub()
        {
            var context = MockContextFactory.Create();

            var tabletService = new TabletService(new MockDataService(context));


            var request = new GetTabletsByModeRequest();

            request.Mode = Database.Models.Mode.Waiter;

            var command = new Command <GetTabletsByModeRequest>();

            command.RequestId = "123";
            command.Arguments = request;

            var called = false;

            var hub = new TabletHub(tabletService);


            var responseType = "GetTabletsByModeResponse";
            var action       = new Action <Command <GetTabletsByModeResponse> >((response) =>
            {
                Assert.Equal(response.RequestId, command.RequestId);
                Assert.NotNull(response.Arguments.Tablets);
                called = true;
            });

            hub.Clients = MockHubFactory.CreateClients(responseType, action);
            hub.GetTabletsByModeRequest(command);

            Assert.True(called);
        }
Exemple #2
0
 public OrderHub(TableService getTablesService,
                 OrderService orderService,
                 OrderPosService orderPosService,
                 AssignOrderService assignOrderService,
                 TabletService tabletService
                 )
 {
     this.getTablesService   = getTablesService;
     this.orderService       = orderService;
     this.orderPosService    = orderPosService;
     this.assignOrderService = assignOrderService;
     this.tabletService      = tabletService;
 }
Exemple #3
0
        public void TestOrderHub()
        {
            var context            = MockContextFactory.Create();
            var getTablesService   = new TableService(new MockDataService(context));
            var orderService       = new OrderService(new MockDataService(context));
            var orderPosService    = new OrderPosService(new MockDataService(context), orderService);
            var assignOrderService = new AssignOrderService(new MockDataService(context));
            var tabletService      = new TabletService(new MockDataService(context));

            context.Table.Add(new Database.Models.Table
            {
                Id   = 12,
                Name = "Hera",
            });

            context.Tablet.Add(new Database.Models.Tablet
            {
                Id         = 7,
                Identifier = "Mira",
                Mode       = Database.Models.Mode.Guest
            });
            context.SaveChanges();

            var request = new CreateOrderRequest();

            request.TableId          = 12;
            request.TabletIdentifier = "Mira";

            var command = new Command <CreateOrderRequest>();

            command.RequestId = "123";
            command.Arguments = request;

            var called = false;

            var hub = new OrderHub(getTablesService, orderService, orderPosService, assignOrderService, tabletService);

            var responseType = "CreateOrderResponse";
            var action       = new Action <Command <CreateOrderResponse> >((response) =>
            {
                Assert.Equal(response.RequestId, command.RequestId);
                Assert.NotNull(response.Arguments.Order);
                called = true;
            });

            hub.Clients = MockHubFactory.CreateClients(responseType, action);
            hub.CreateOrderRequest(command);

            Assert.True(called);
        }
Exemple #4
0
 public TabletHub(TabletService tabletService)
 {
     this.tabletService = tabletService;
 }