public void Returns_null_UserIdentity_When_Not_registered() { var context = new NancyContext(); var sut = new TwitterUserTracker(); var result = sut.GetUserFromIdentifier(Guid.NewGuid(), context); result.Should().BeNull(); }
public void When_registered_Can_retrieve_UserIdentity_from_Session_Id() { const long TwitterUserId = 123L; var sessionid = Guid.NewGuid(); var client = A.Fake <ITwitterAuthenticatedClient>(); A.CallTo(() => client.UserId).Returns(TwitterUserId); var context = new NancyContext(); var sut = new TwitterUserTracker(); sut.Register(sessionid, client); var user = sut.GetUserFromIdentifier(sessionid, context); user.Should().NotBeNull(); user.Should().BeOfType <TwitterUser>(); user.As <TwitterUser>().TwitterUserId.Should().Be(TwitterUserId); }