예제 #1
0
        public void TestUserResponseGetAvatarUrl()
        {
            var userResponse = new UserResponse()
            {
                Id     = "my_id",
                Avatar = "my_avatar"
            };

            var expected = $"https://cdn.discordapp.com/avatars/{userResponse.Id}/{userResponse.Avatar}.png";

            Assert.AreEqual(expected, userResponse.GetAvatarUrl());
        }
        public void TestSetsUser()
        {
            var auth = new AuthorizationContext()
            {
                Provider = _userProvider.Name,
                Data     = new Dictionary <string, string>()
                {
                    { "code", "test" }
                }
            };

            var identity = _statelessIdentityProvider.CreateIdentity(auth);

            Assert.NotNull(identity?.User);
            Assert.AreEqual(_defaultUserResponse.Username, identity.User.Name);

            var data = identity.User?.Data;

            Assert.NotNull(data);
            Assert.IsTrue(data.ContainsKey("avatarUrl"));
            Assert.AreEqual(_defaultUserResponse.GetAvatarUrl(), data["avatarUrl"]);
        }