public async Task HandleAsync_GivenMessageContainingUpdatedAmounts_AmountsAreUpdatedCorrectly()
        {
            var updatedValues = new List <NonObligatedValue>()
            {
                new NonObligatedValue(A.Dummy <int>(), 1, false, Guid.NewGuid()),
                new NonObligatedValue(A.Dummy <int>(), 2, false, Guid.NewGuid())
            };

            var message = new EditNonObligated()
            {
                CategoryValues = updatedValues
            };

            var returnAmounts = new List <NonObligatedWeee>()
            {
                new NonObligatedWeee(A.Fake <Return>(), 1, false, 1),
                new NonObligatedWeee(A.Fake <Return>(), 2, false, 2)
            };

            A.CallTo(() => genericDataAccess.GetById <NonObligatedWeee>(updatedValues.ElementAt(0).Id)).Returns(returnAmounts.ElementAt(0));
            A.CallTo(() => genericDataAccess.GetById <NonObligatedWeee>(updatedValues.ElementAt(1).Id)).Returns(returnAmounts.ElementAt(1));

            await handler.HandleAsync(message);

            A.CallTo(() => nonObligatedDataAccess.UpdateAmount(returnAmounts.ElementAt(0), 1)).MustHaveHappened(Repeated.Exactly.Once);
            A.CallTo(() => nonObligatedDataAccess.UpdateAmount(returnAmounts.ElementAt(1), 2)).MustHaveHappened(Repeated.Exactly.Once);
        }
        public async Task <bool> HandleAsync(EditNonObligated message)
        {
            authorization.EnsureCanAccessExternalArea();

            foreach (var nonObligatedValue in message.CategoryValues)
            {
                var value = await genericDataAccess.GetById <NonObligatedWeee>(nonObligatedValue.Id);

                await dataAccess.UpdateAmount(value, nonObligatedValue.Tonnage);
            }

            return(true);
        }