Example #1
0
        public AccountsModule(
            MikiApp app,
            Config config,
            IDiscordClient discordClient,
            AccountService accountsService,
            AchievementService achievementService,
            AchievementEvents achievementEvents,
            TransactionEvents transactionEvents)
        {
            this.app = app;
            this.achievementService = achievementService;
            this.discordClient      = discordClient;
            if (!string.IsNullOrWhiteSpace(config.ImageApiUrl))
            {
                client = new HttpClient(config.ImageApiUrl);
            }
            else
            {
                Log.Warning("Image API can not be loaded in AccountsModule");
            }

            discordClient.Events.MessageCreate.SubscribeTask(OnMessageCreateAsync);

            accountsService.OnLocalLevelUp          += OnUserLevelUpAsync;
            accountsService.OnLocalLevelUp          += OnLevelUpAchievementsAsync;
            transactionEvents.OnTransactionComplete += CheckCurrencyAchievementUnlocksAsync;

            achievementEvents.OnAchievementUnlocked
            .SubscribeTask(SendAchievementNotificationAsync);
            achievementEvents.OnAchievementUnlocked
            .SubscribeTask(CheckAchievementUnlocksAsync);
        }
 public void ResetHarvestData()
 {
     Metrics.Clear();
     CustomEvents.Clear();
     TransactionTraces.Clear();
     TransactionEvents.Clear();
     ErrorTraces.Clear();
     ErrorEvents.Clear();
     SpanEvents.Clear();
 }
Example #3
0
        public static String AsText(this TransactionEvents TransactionEvents)
        {
            switch (TransactionEvents)
            {
            case TransactionEvents.Started:
                return("Started");

            case TransactionEvents.Updated:
                return("Updated");

            case TransactionEvents.Ended:
                return("Ended");


            default:
                return("Unknown");
            }
        }
Example #4
0
        public async Task InvalidCurrencyTransferTest()
        {
            var unit        = NewContext();
            var userService = new UserService(unit, null);

            // TODO: replace with better testing solution.
            bool ranCallback = false;

            var events = new TransactionEvents();

            events.OnTransactionFailed += (a, b) =>
            {
                Assert.IsType <InsufficientCurrencyException>(b);
                ranCallback = true;
                return(Task.CompletedTask);
            };

            var service = new TransactionService(userService, events);

            await Assext.ThrowsRootAsync <InsufficientCurrencyException>(
                async() => await service.CreateTransactionAsync(new TransactionRequest(2L, 1L, 10)));

            Assert.True(ranCallback, "TransactionService did not call error event");
        }
Example #5
0
 public void RemoveEventListener(TransactionEvents type, IEventListener listener, bool capture)
 {
 }
Example #6
0
 public void RemoveEventListener(TransactionEvents type, IEventListener listener)
 {
 }
Example #7
0
 public void RemoveEventListener(TransactionEvents type, HtmlEventHandlerWithTarget<Transaction> listener, bool capture)
 {
 }
Example #8
0
 public void RemoveEventListener(TransactionEvents type, HtmlEventHandler listener)
 {
 }
Example #9
0
 public void AddEventListener(TransactionEvents type, IEventListener listener)
 {
 }
Example #10
0
 public void AddEventListener(TransactionEvents type, HtmlEventHandlerWithTarget<Transaction> listener)
 {
 }
Example #11
0
 public void RemoveEventListener(TransactionEvents type, HtmlEventHandler listener, bool capture)
 {
 }
Example #12
0
 public void AddEventListener(TransactionEvents type, Action listener, bool capture)
 {
 }
Example #13
0
 public void AddEventListener(TransactionEvents type, HtmlEventHandlerWithTarget <Transaction> listener, bool capture)
 {
 }
Example #14
0
 public void AddEventListener(TransactionEvents type, IEventListener listener)
 {
 }
Example #15
0
 public void AddEventListener(TransactionEvents type, HtmlEventHandler listener)
 {
 }
Example #16
0
 public void RemoveEventListener(TransactionEvents type, IEventListener listener)
 {
 }
Example #17
0
 public void RemoveEventListener(TransactionEvents type, HtmlEventHandlerWithTarget <Transaction> listener)
 {
 }
Example #18
0
 public TransactionService(IUserService service, [Optional] TransactionEvents events)
 {
     this.events  = events;
     this.service = service;
 }
Example #19
0
 public void AddEventListener(TransactionEvents type, HtmlEventHandler listener, bool capture)
 {
 }
Example #20
0
 public void AddEventListener(TransactionEvents type, IEventListener listener, bool capture)
 {
 }
Example #21
0
 public void RemoveEventListener(TransactionEvents type, Action listener, bool capture)
 {
 }