Пример #1
0
        public void ParameterArgumentNullCheck()
        {
            // Arrange
            var sut = new GetUserByIdHandler();

            // Act & Assert
            Assert.ThrowsAsync <ArgumentException>(() => sut.ExecuteAsync(null !));
        }
Пример #2
0
        public void InstantiateConstructor()
        {
            // Act
            var actual = new GetUserByIdHandler();

            // Assert
            Assert.NotNull(actual);
        }
Пример #3
0
        public async void SouldReturnSuccess_WhenListUser()
        {
            // arrange
            var(repo, context) = GetRepository();

            var entity = new UserEntity {
                Email = "*****@*****.**", Name = "test1", Password = "******"
            };

            _ = await repo.Save(entity);

            var comando = new GetUserByIdCommand {
                Id = 1
            };
            var handler = new GetUserByIdHandler(repo);

            // act
            var ret = await handler.Handle(comando, CancellationToken.None);

            // assert
            var result = context.UserEntityDb.Find(comando.Id);

            Assert.True(ret.Data.Email == result.Email);
        }
 public GetUserByIdHandlerTest()
 {
     _authRepository = Substitute.For <IAuthRepository>();
     _handler        = new GetUserByIdHandler(_authRepository);
 }