示例#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();
 }
示例#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");
            }
        }
示例#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");
        }
示例#5
0
 public void RemoveEventListener(TransactionEvents type, IEventListener listener, bool capture)
 {
 }
示例#6
0
 public void RemoveEventListener(TransactionEvents type, IEventListener listener)
 {
 }
示例#7
0
 public void RemoveEventListener(TransactionEvents type, HtmlEventHandlerWithTarget<Transaction> listener, bool capture)
 {
 }
示例#8
0
 public void RemoveEventListener(TransactionEvents type, HtmlEventHandler listener)
 {
 }
示例#9
0
 public void AddEventListener(TransactionEvents type, IEventListener listener)
 {
 }
示例#10
0
 public void AddEventListener(TransactionEvents type, HtmlEventHandlerWithTarget<Transaction> listener)
 {
 }
示例#11
0
 public void RemoveEventListener(TransactionEvents type, HtmlEventHandler listener, bool capture)
 {
 }
示例#12
0
 public void AddEventListener(TransactionEvents type, Action listener, bool capture)
 {
 }
示例#13
0
 public void AddEventListener(TransactionEvents type, HtmlEventHandlerWithTarget <Transaction> listener, bool capture)
 {
 }
示例#14
0
 public void AddEventListener(TransactionEvents type, IEventListener listener)
 {
 }
示例#15
0
 public void AddEventListener(TransactionEvents type, HtmlEventHandler listener)
 {
 }
示例#16
0
 public void RemoveEventListener(TransactionEvents type, IEventListener listener)
 {
 }
示例#17
0
 public void RemoveEventListener(TransactionEvents type, HtmlEventHandlerWithTarget <Transaction> listener)
 {
 }
示例#18
0
 public TransactionService(IUserService service, [Optional] TransactionEvents events)
 {
     this.events  = events;
     this.service = service;
 }
示例#19
0
 public void AddEventListener(TransactionEvents type, HtmlEventHandler listener, bool capture)
 {
 }
示例#20
0
 public void AddEventListener(TransactionEvents type, IEventListener listener, bool capture)
 {
 }
示例#21
0
 public void RemoveEventListener(TransactionEvents type, Action listener, bool capture)
 {
 }