public void ChangeKnockoutTitleTest()
        {
            TestDb = DataBaseMock();
            TestDb.Setup(m => m.AddKnockoutTitle("Test", "1234")).Verifiable();

            var knockoutTest = new KnockOutHandler(1234, TestDb.Object);

            knockoutTest.ChangeKnockoutTitle("Test");

            Assert.DoesNotThrow(() => TestDb.Verify());
        }
Exemplo n.º 2
0
        public async Task AddKnockoutAsync([Remainder] string input = "")
        {
            if (!StateChecker.IsPrivateMessage(Context))
            {
                return;
            }

            if (input == "")
            {
                await Context.Channel.SendMessageAsync(":x: No Value Entered!");

                return;
            }

            var channelId = KnockOutHandler.ChannelForUser(Context.User.Id, Factory.GetDatabase());

            if (channelId == 0)
            {
                await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!");

                return;
            }

            var knockouts = new KnockOutHandler(channelId, Factory.GetDatabase());

            if (knockouts.KnockoutCreatorUlong != Context.User.Id)
            {
                await Context.Channel.SendMessageAsync(":x: You are not making a knockout at the moment!");

                return;
            }

            switch (knockouts.KnockoutStatus)
            {
            case 1:
                await Context.Channel.SendMessageAsync(":x: No Knockout is being created at the moment!");

                return;

            case 2:
                await Context.Channel.SendMessageAsync(":x: This knockout has already started! No more changes!");

                return;

            case 3:
                await Context.Channel.SendMessageAsync(":x: This knockout is finished, please feel free to create a new one!");

                return;

            case 4:
                break;

            default:
                await Context.Channel.SendMessageAsync(":x: Right. This shouldn't have happened. Someone call RedFlint.");

                return;
            }

            knockouts.ChangeKnockoutTitle(input);

            await Context.Channel.SendMessageAsync($"You have named your knockout: {input}");
        }