예제 #1
0
        public Task GetMenuItemsShouldReturnProperHypermediaLinksWhenLoggedInAsAManager(AddMenuItems command, Fixture fixture) =>
        _apiHelper.InTheContextOfAManager(
            manager => async client =>
        {
            // Arrange
            await _fixture.SendAsync(command);

            // Act
            var response = await client
                           .GetAsync(MenuRoute("items"));

            // Assert
            var expectedLinks = new List <string>
            {
                LinkNames.Self
            };

            var resource = await response.ShouldBeAResource <MenuItemsContainerResource>(expectedLinks);

            var expectedMenuItemLinks = new List <string>
            {
                LinkNames.Menu.AddMenuItem
            };

            resource.Items.ShouldAllBe(i => i.Links.All(l => expectedMenuItemLinks.Contains(l.Key)));
        },
            fixture);
예제 #2
0
        public Task HireCashierShouldReturnProperHypermediaLinks(HireCashier command, Fixture fixture) =>
        _apiHelper.InTheContextOfAManager(
            manager => async httpClient =>
        {
            // Act
            var response = await httpClient
                           .PostAsJsonAsync("cashier", command);

            // Assert
            var expectedLinks = new List <string>
            {
                LinkNames.Self,
                LinkNames.Cashier.GetAll
            };

            await response.ShouldBeAResource <HireCashierResource>(expectedLinks);
        },
            fixture);
예제 #3
0
        public Task GetEmployedWaitersShouldReturnProperHypermediaLinks(HireWaiter[] waitersToHire, Fixture fixture) =>
        _apiHelper.InTheContextOfAManager(
            manager => async httpClient =>
        {
            // Arrange
            await _fixture.SendManyAsync(waitersToHire);

            // Act
            var response = await httpClient.GetAsync(WaiterRoute());

            // Assert
            var expectedLinks = new List <string>
            {
                LinkNames.Self,
                LinkNames.Waiter.Hire
            };

            var resource = await response.ShouldBeAResource <WaitersContainerResource>(expectedLinks);

            resource.Items.ShouldAllBe(r => r.Links.Count > 0);
        },
            fixture);
예제 #4
0
        public Task AddTableShouldReturnProperHypermediaLinks(AddTable command, Fixture fixture) =>
        _apiHelper.InTheContextOfAManager(
            manager => async httpClient =>
        {
            // Act
            var response = await httpClient
                           .PostAsJsonAsync(TableRoute(), command);

            // Assert
            var expectedLinks = new List <string>
            {
                LinkNames.Self,
                LinkNames.Table.GetAll
            };

            await response.ShouldBeAResource <AddTableResource>(expectedLinks);
        },
            fixture);