Exemplo n.º 1
0
 public async Task HandlerShouldThrowMemberUnknownExceptionIfMemberUnknown()
 {
     //arrange
     var memberId                = new MemberId(Guid.NewGuid());
     var memberRepository        = new InMemoryMemberRepository(new());
     var command                 = new AnswerBetCommand(Guid.Empty, true);
     var authentificationGateway = new InMemoryAuthenticationGateway(true, memberId.Value);
     var handler                 = new AnswerBetCommandHandler(memberRepository, new InMemoryBetRepository(), authentificationGateway, new FakeDateTimeProvider(default));
Exemplo n.º 2
0
        public async Task ShouldSignInIfLoginPasswordOk()
        {
            var authentication        = new Authentication("username", "passwordpassword", "token");
            var authenticationGateway = new InMemoryAuthenticationGateway(authentication);
            var command   = new SignInCommand("username", "password");
            var presenter = new SignInTestPresenter();
            var handler   = new SignInCommandHandler(authenticationGateway, presenter, new FakeHashPassword());

            await handler.Handle(command);

            Assert.Equal("token", presenter.GetToken());
        }
Exemplo n.º 3
0
        public async Task ShouldNotGetTokenIfAuthenticationFailed()
        {
            var authentication        = new Authentication("user", "pass", "token");
            var authenticationGateway = new InMemoryAuthenticationGateway(authentication);
            var command   = new SignInCommand("username", "password");
            var presenter = new SignInTestPresenter();
            var handler   = new SignInCommandHandler(authenticationGateway, presenter, new FakeHashPassword());

            await handler.Handle(command);

            Assert.Collection(presenter.GetErrors(), x =>
            {
                Assert.Equal("Identification failed", x);
            });
        }