Ejemplo n.º 1
0
        public async Task Should_update_a_coffee_place()
        {
            var command = new UpdateCoffeePlaceCommandBuilder()
                          .Build();

            var coffeePlace = new CoffeePlaceBuilder()
                              .WithId(command.CoffeePlaceId)
                              .Build();

            _coffeePlaceRepository
            .GetByIdAsync(command.CoffeePlaceId)
            .Returns(coffeePlace);

            var response = await _coffeePlaceService
                           .Update(command);

            response
            .Id
            .Should()
            .Be(command.CoffeePlaceId);
            response
            .Name
            .Should()
            .Be(command.Name);
            response
            .PersonCoffeePlaceAssociations
            .Should()
            .BeEmpty();
        }
Ejemplo n.º 2
0
        public void Should_not_update_a_coffee_place_if_they_are_not_found()
        {
            var command = new UpdateCoffeePlaceCommandBuilder()
                          .Build();

            _coffeePlaceRepository
            .GetByIdAsync(command.CoffeePlaceId)
            .ReturnsNull();

            Action act = () => _coffeePlaceService
                         .Update(command)
                         .GetAwaiter()
                         .GetResult();

            act
            .Should()
            .Throw <NotFoundException>()
            .Where(w => w.Message == "Cafeteria não encontrada");
        }