Пример #1
0
        public void GetUserIdForEmail_MultipleUsersWithEmailSet_ReturnsCorrectUser()
        {
            // given
            var slackUser1 = new SlackUser()
            {
                Id    = "ABC",
                Email = "*****@*****.**"
            };
            var slackUser2 = new SlackUser()
            {
                Id    = "DEF",
                Email = "*****@*****.**"
            };
            var slackUser3 = new SlackUser()
            {
                Id    = "QWE",
                Email = "*****@*****.**"
            };

            var userCache = new ReadOnlyDictionary <string, SlackUser>(new Dictionary <string, SlackUser>
            {
                { slackUser1.Id, slackUser1 },
                { slackUser2.Id, slackUser2 },
                { slackUser3.Id, slackUser3 },
            });


            // when
            var result = userCache.FindByEmail("*****@*****.**");

            // then
            result.Id.ShouldBe("ABC");
        }
Пример #2
0
        public void GetUserIdForEmail_WithoutEmailSet_ReturnsNull()
        {
            // given
            var slackUser = new SlackUser()
            {
                Id = "ABC"
            };

            var userCache = new ReadOnlyDictionary <string, SlackUser>(new Dictionary <string, SlackUser>
            {
                { slackUser.Id, slackUser }
            });


            // when
            var result = userCache.FindByEmail("*****@*****.**");

            // then
            result.ShouldBeNull();
        }