public void SearchRolesAndRightsInformationViewModelTest_Instantiation()
        {
            // Arrange
            Mock <ILog> logger = new Mock <ILog>();

            Mock <IRestQuery> query = new Mock <IRestQuery>();

            // Act
            SearchRolesAndRightsInformationViewModel target = new SearchRolesAndRightsInformationViewModel(logger.Object, mapper, query.Object);

            // Assert
            Assert.IsNotNull(target.Model);
            Assert.IsNotNull(target.SearchCommand);
        }
        private static SearchRolesAndRightsInformationViewModel GetViewModel()
        {
            Mock <ILog> logger = new Mock <ILog>();

            List <Role> roles = new List <Role>();

            roles.Add(new Role());

            Mock <IRestQuery> query = new Mock <IRestQuery>();

            query.Setup(s => s.Get <Role>(It.Is <List <KeyValuePair <string, string> > >(l => l.Count == 2))).Returns(roles);

            SearchRolesAndRightsInformationViewModel target = new SearchRolesAndRightsInformationViewModel(logger.Object, mapper, query.Object);

            return(target);
        }
        public void SearchOrganizationInformationViewModelTest_EMailSearch_SearchResultIsUpdated()
        {
            // Arrange
            PubSub <ObservableCollection <RoleModel> > .RegisterEvent(EventNames.RoleSearchResultReceivedEvent, this.RoleSearchResultReceivedEventHandler);

            Mock <ILog> logger = new Mock <ILog>();

            IList <Role> roles = new List <Role>();

            roles.Add(new Role());

            Mock <IRestQuery> query = new Mock <IRestQuery>();
            var ting = new List <KeyValuePair <string, string> >()
            {
            };

            query.Setup(s => s.Get <Role>(It.Is <List <KeyValuePair <string, string> > >(l => l.Count == 2))).Returns(roles);


            SearchRolesAndRightsInformationModel search = new SearchRolesAndRightsInformationModel
            {
                SubjectSearchText  = "16024400143",
                ReporteeSearchText = "910028146"
            };

            SearchRolesAndRightsInformationViewModel target = new SearchRolesAndRightsInformationViewModel(logger.Object, mapper, query.Object);

            // Act
            target.SearchCommand.Execute(search);

            // Wait for tasks to complete.
            Thread.Sleep(1000);

            // Assert
            query.VerifyAll();

            Assert.IsNotNull(this.searchResult);
            Assert.IsNotNull(target.SearchCommand);
            Assert.IsNotNull(target.Model);
        }
        public void SearchRolesAndRightsInformationViewModelTest_SendsEventWhenSearchResultIsReceived()
        {
            // Arrange
            PubSub <ObservableCollection <RoleModel> > .RegisterEvent(EventNames.RoleSearchResultReceivedEvent, this.RoleSearchResultReceivedEventHandler);

            SearchRolesAndRightsInformationModel search = new SearchRolesAndRightsInformationModel
            {
                SubjectSearchText  = "16024400143",
                ReporteeSearchText = "910028146"
            };

            SearchRolesAndRightsInformationViewModel target = GetViewModel();

            // Act
            target.SearchCommand.Execute(search);

            // Wait for tasks to complete.
            Thread.Sleep(1000);

            // Asserts
            Assert.IsNotNull(this.searchResult);
        }