Example #1
0
        public void GetUserByName_FindsUserWithMatchingName_AndCaches()
        {
            var expectedUser = new User {
                Id = "U1", Name = "foo"
            };
            var otherUser = new User {
                Id = "U2", Name = "bar"
            };

            _api.Users.List().Returns(new UserListResponse {
                Members = { otherUser, expectedUser }
            });

            _sut.GetUserByName("@foo")
            .ShouldComplete()
            .And.ShouldBe(expectedUser);
            _sut.GetUserByName("foo")
            .ShouldComplete()
            .And.ShouldBe(expectedUser);
            _api.Users.Received(1).List();
        }