Example #1
0
        public async Task MemberClient_GetPoints_ToUserThatExists_ReturnsSamePoints()
        {
            // arrange
            var amount = Rng.Next();

            var          channel = GetChannel();
            var          client  = new Member.MemberClient(channel);
            const string guildId = "1";
            const string userId  = "1";

            var getQuery = new MemberQuery
            {
                GuildId = guildId,
                UserId  = userId
            };

            var addQuery = new MemberQueryWithPoints
            {
                GuildId = guildId,
                UserId  = userId,
                Amount  = amount
            };

            // act
            var addResult = await client.AddPointsAsync(addQuery);

            var getResult = await client.GetPointsAsync(getQuery);

            // assert
            Assert.AreEqual(Status.Success, addResult.Status, "AddPointsAsync() failed.");
            Assert.AreEqual(amount, addResult.Experience);
            Assert.AreEqual(Status.Success, getResult.Status, "GetPointsAsync() failed.");
            Assert.AreEqual(amount, getResult.Experience);
        }
Example #2
0
        public async Task MemberClient_RemovePoints_ToUserThatExistsWithNegativeSubstractionResult_ReturnsZero()
        {
            // arrange
            const int addAmount    = 5;
            const int removeAmount = 8;

            var          channel = GetChannel();
            var          client  = new Member.MemberClient(channel);
            const string guildId = "1";
            const string userId  = "1";

            var addQuery = new MemberQueryWithPoints
            {
                GuildId = guildId,
                UserId  = userId,
                Amount  = addAmount
            };
            var removeQuery = new MemberQueryWithPoints
            {
                GuildId = guildId,
                UserId  = userId,
                Amount  = removeAmount
            };

            // act
            var addResult = await client.AddPointsAsync(addQuery);

            var removeResult = await client.RemovePointsAsync(removeQuery);

            // assert
            Assert.AreEqual(Status.Success, addResult.Status, "AddPointsAsync() failed.");
            Assert.AreEqual(addAmount, addResult.Experience);
            Assert.AreEqual(Status.Success, removeResult.Status, "RemovePointsAsync() failed.");
            Assert.AreEqual(0, removeResult.Experience);
        }