Ejemplo n.º 1
0
        public async Task HandleAsync_GivenGetSentOnAatfSiteRequest_DataAccessIsCalled()
        {
            var weeeSentOnId     = Guid.NewGuid();
            var weeeSentOn       = new WeeeSentOn();
            var weeeSentOnAmount = new List <WeeeSentOnAmount>();

            A.CallTo(() => genericDataAccess.GetById <WeeeSentOn>(weeeSentOnId)).Returns(weeeSentOn);
            A.CallTo(() => obligatedWeeeDataAccess.FetchObligatedWeeeSentOnForReturn(weeeSentOnId)).Returns(weeeSentOnAmount);

            await handler.HandleAsync(new RemoveWeeeSentOn(weeeSentOnId));

            A.CallTo(() => genericDataAccess.Remove(weeeSentOn)).MustHaveHappened(Repeated.Exactly.Once);
            A.CallTo(() => genericDataAccess.RemoveMany(weeeSentOnAmount)).MustHaveHappened(Repeated.Exactly.Once);
        }
Ejemplo n.º 2
0
        public async Task HandleAsync_NoExternalAccess_ThrowsSecurityException()
        {
            var authorization = new AuthorizationBuilder().DenyExternalAreaAccess().Build();

            var handler = new RemoveWeeeSentOnHandler(context, authorization, sentOnDataAccess, genericDataAccess, obligatedWeeeDataAccess);

            Func <Task> action = async() => await handler.HandleAsync(A.Dummy <RemoveWeeeSentOn>());

            await action.Should().ThrowAsync <SecurityException>();
        }