Esempio n. 1
0
        public async Task Handler_Does_Not_Remove_When_Not_Found_For_Id()
        {
            await InitializeRecords();

            var command = new WishDeleteCommand(Guid.NewGuid(), _testCommand.User);

            await _handler.Handle(command);

            var exists = await _context.Wishes.AnyAsync(w => w.Id == _testCommand.Id);

            exists.Should().BeTrue();
        }
Esempio n. 2
0
        public async Task Handler_Does_Not_Delete_Wish_For_Different_User()
        {
            await InitializeRecords();

            var command = new WishDeleteCommand(_testCommand.Id, new ApplicationUser {
                Id = Guid.NewGuid()
            });

            await _handler.Handle(command);

            var exists = await _context.Wishes.AnyAsync(w => w.Id == _testCommand.Id);

            exists.Should().BeTrue();
        }
Esempio n. 3
0
        public WishDeleteCommandHandlerTests()
        {
            var fixture = new Fixture();

            fixture.Behaviors.Add(new OmitOnRecursionBehavior());

            _context = InitializeDatabase();

            _testCommand = fixture.Create <WishDeleteCommand>();
            _testRecord  = fixture
                           .Build <WishRecord>()
                           .With(w => w.Id, _testCommand.Id)
                           .With(w => w.User, _testCommand.User)
                           .With(w => w.UserId, _testCommand.User.Id)
                           .Create();

            _handler = new WishDeleteCommandHandler(_context);
        }