Пример #1
0
        public async Task ActivitiesEdit_Exception()
        {
            var command = _fixture.Create <Edit.Command>();

            var query = new Edit.Handler(_repo.Object);

            await Assert.ThrowsAsync <RestException>(async() => await query.Handle(command, new CancellationToken()));

            _repo.Verify(x => x.GetActivity(It.IsAny <Guid>()));
            _repo.VerifyNoOtherCalls();
            _mediator.VerifyNoOtherCalls();
        }
Пример #2
0
        public async Task ActivitiesEdit_Success()
        {
            var command  = _fixture.Create <Edit.Command>();
            var activity = _fixture.Build <Activity>().Without(x => x.UserActivities).Without(x => x.Comments).Create();

            command.Id = activity.Id;

            _repo.Setup(x => x.GetActivity(activity.Id)).ReturnsAsync(activity);
            _repo.Setup(x => x.SaveAll()).ReturnsAsync(true);

            var query = new Edit.Handler(_repo.Object);
            await query.Handle(command, new CancellationToken());

            _repo.Verify(x => x.GetActivity(It.IsAny <Guid>()));
            _repo.Verify(x => x.SaveAll());
            _repo.VerifyNoOtherCalls();
            _mediator.VerifyNoOtherCalls();
        }