public void ModerationViewModel_ModerationState_Denied() { var roomUnavailSetting = new RoomUnavailableSetting(); roomUnavailSetting.Initialize(); var moderationVm = viewModelFactory.GetViewModel <ModerationViewModel>(); moderationVm.RoomUnavailableSetting = roomUnavailSetting; moderationVm.ModerationState = ModerationState.Denied; Assert.AreEqual(Visibility.Collapsed, moderationVm.SendRequestVisibility); Assert.AreEqual(Visibility.Visible, moderationVm.RequestDeniedVisibility); Assert.AreEqual(Visibility.Collapsed, moderationVm.WaitingForResponseVisibility); }
public void ModerationViewModel_Initialize() { var companyVm = viewModelFactory.GetViewModel <CompanyViewModel>(); var agVm = viewModelFactory.GetViewModel <AuthenticationGroupViewModel>(); var localUserVm = viewModelFactory.GetViewModel <LocalUserViewModel>(); localUserVm.CompanyInfo = new TestCompanyInfo(); localUserVm.LoginSession = new LoginSession { LoginSessionId = Guid.NewGuid().ToString(), InvitationId = Guid.NewGuid(), UserId = user.UserId }; bool getAuthenticatedUserCalled = false; bool getRoomIdCalled = false; mockRoomService.Setup(rs => rs.GetAuthenticatedUser(It.IsAny <LoginSession>(), It.IsAny <OperationCallback <User> >())) .Callback((LoginSession loginSession, OperationCallback <User> callback) => { getAuthenticatedUserCalled = true; callback(null, user); }); mockRoomService.Setup(rs => rs.GetRoomId(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <OperationCallback <ShortRoomInfo> >())) .Callback((string companyTag, string authenticationGroupTag, string userTag, string roomTag, OperationCallback <ShortRoomInfo> callback) => { getRoomIdCalled = true; var roomInfo = new ShortRoomInfo { RoomId = room.RoomId }; callback(null, roomInfo); }); var roomUnavailSetting = new RoomUnavailableSetting(); roomUnavailSetting.Initialize(); var moderationVm = viewModelFactory.GetViewModel <ModerationViewModel>(); moderationVm.RoomUnavailableSetting = roomUnavailSetting; Assert.IsFalse(getAuthenticatedUserCalled); Assert.IsFalse(getRoomIdCalled); companyVm.Model = TestGlobals.Company; Assert.IsFalse(getAuthenticatedUserCalled); Assert.IsFalse(getRoomIdCalled); agVm.Model = TestGlobals.AuthenticationGroup; Assert.IsTrue(getAuthenticatedUserCalled); Assert.IsTrue(getRoomIdCalled); Assert.AreEqual(ModerationState.Start, moderationVm.ModerationState); Assert.AreEqual(Visibility.Visible, moderationVm.SendRequestVisibility); }