public void RequireCurrentUser_raises_exception_when_they_are_not_logged_in([Frozen] IIdentityReader identityReader, [Frozen, InMemory] IEntityData query, CurrentUserReader sut) { // Arrange Mock.Get(identityReader) .Setup(x => x.GetCurrentUserInfo()) .Returns((ICurrentUserInfo)null); // Act & assert Assert.Throws <CurrentUserNotIdentifiedException>(() => sut.RequireCurrentUser()); }
public void RequireCurrentUser_raises_exception_when_they_are_not_found([Frozen] IIdentityReader identityReader, [Frozen, InMemory] IEntityData query, CurrentUserReader sut, ICurrentUserInfo userInfo, [HasIdentity] User user) { // Arrange SetupCurrentUserIdentity(user, userInfo, identityReader); // Act & assert Assert.Throws <CurrentUserNotIdentifiedException>(() => sut.RequireCurrentUser()); }
public void RequireCurrentUser_returns_user_when_they_are_logged_in([Frozen] IIdentityReader identityReader, [Frozen, InMemory] IEntityData query, CurrentUserReader sut, ICurrentUserInfo userInfo, [HasIdentity] User user) { // Arrange FullySetupLoggedInUser(user, userInfo, query, identityReader); // Act var result = sut.RequireCurrentUser(); // Assert Assert.AreSame(user, result); }