Exemplo n.º 1
0
        public Task GetAllUserAccountShouldReturnProperHypermediaLinks(Register[] registerCommands) =>
        _apiHelper.InTheContextOfAnAdmin(
            async httpClient =>
        {
            // Arrange
            await _fixture.SendManyAsync(registerCommands);

            // Act
            var response = await httpClient.GetAsync(AuthRoute("users"));

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

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

            var expectedPerUserLinks = new List <string>
            {
                LinkNames.Auth.AssignWaiter,
                LinkNames.Auth.AssignManager,
                LinkNames.Auth.AssignCashier,
                LinkNames.Auth.AssignBarista
            };

            resource.Items.ShouldAllBe(i => expectedPerUserLinks.All(el => i.Links.Any(l => l.Key == el)));
        });
Exemplo n.º 2
0
        public Task HireManagerShouldReturnProperHypermediaLinks(HireManager command) =>
        _apiHelper.InTheContextOfAnAdmin(
            async httpClient =>
        {
            // Act
            var response = await httpClient
                           .PostAsJsonAsync("manager", command);

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

            await response.ShouldBeAResource <HireManagerResource>(expectedLinks);
        });