public void ThatExist()
            {
                var endpoint = TestableRegisterEndpoint.Build(Session);
                var command = new DuplicateUsernameCommand {Username = DefaultUser.Username};

                endpoint.ValidateUsername(command).IsValid.ShouldBeFalse();
            }
            public void ThatDontExist()
            {
                var endpoint = TestableRegisterEndpoint.Build(Session);
                var command = new DuplicateUsernameCommand { Username = "******" };

                endpoint.ValidateUsername(command).IsValid.ShouldBeTrue();
            }
 public DuplicateUsernameResponse ValidateUsername(DuplicateUsernameCommand command)
 {
     var exists = _session.Query<UserAccount>().Any(x => x.Username == command.Username);
     return new DuplicateUsernameResponse { IsValid = !exists };
 }