Ejemplo n.º 1
0
        public async Task ShouldReturnNull()
        {
            //Arrange
            var handler = new GetFriendByIdQueryHandler(_context);

            //Act
            ApplicationUser friend = await handler.Handle(new GetFriendByIdQuery
            {
                Id = Guid.NewGuid().ToString()
            }, CancellationToken.None);

            //Assert
            friend.Should().BeNull();
        }
Ejemplo n.º 2
0
        public async Task ShouldReturnApplicationUser()
        {
            //Arrange
            ApplicationUser user = new ApplicationUser();

            await _context.ApplicationUsers.AddAsync(user);

            await _context.SaveChangesAsync();

            var handler = new GetFriendByIdQueryHandler(_context);

            //Act
            ApplicationUser friend = await handler.Handle(new GetFriendByIdQuery
            {
                Id = user.Id
            }, CancellationToken.None);

            //Assert
            friend.Should().NotBeNull();
            friend.Id.Should().Be(user.Id);
        }