public void ShouldWrapElementsToComboBoxesOrEditableComboBoxesAsAppropriate() { var wrapperFactory = new WrapperFactory(); Window window = LaunchPetShopWindow(); AutomationElement editableComboBox = window.Element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "petTypeInput")); AutomationElement comboBox = window.Element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "petFoodInput")); Assert.IsAssignableFrom(typeof(EditableComboBox), wrapperFactory.Wrap <ComboBox>(editableComboBox, "anEditableComboBox")); Assert.IsAssignableFrom(typeof(ComboBox), wrapperFactory.Wrap <ComboBox>(comboBox, "aNormalComboBox")); }
public void ShouldWrapElementsToComboBoxesOrEditableComboBoxesAsAppropriate() { var wrapperFactory = new WrapperFactory(); Window window = LaunchPetShopWindow(); AutomationElement editableComboBox = window.Element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "petTypeInput")); AutomationElement comboBox = window.Element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "petFoodInput")); Assert.IsAssignableFrom(typeof(EditableComboBox), wrapperFactory.Wrap<ComboBox>(editableComboBox, "anEditableComboBox")); Assert.IsAssignableFrom(typeof(ComboBox), wrapperFactory.Wrap<ComboBox>(comboBox, "aNormalComboBox")); }
public ParticipantsManagementViewModel BuildIndex(IDisplayPagination pagination, bool allowHistory = false, ParticipantsManagementViewModel.Filters?filters = null) { var currentConvention = Actor.ManagedConvention.ConventionId; var query = Session.Query <ConventionEngagement>() .Include(x => x.ParticipantId) .Include(x => x.EventIds) .AsQueryable(); if (allowHistory == false) { query = query.Where(x => x.ConventionId == currentConvention); } var engagements = query.ToList(); var wrapperFactory = new WrapperFactory(Session); var result = new ParticipantsManagementViewModel { filters = filters, Pagination = pagination, Engagements = wrapperFactory.Wrap(engagements) }; return(result); }
public void ShouldWrapThirdPartyExtensions() { var wrapperFactory = new WrapperFactory(); Window window = LaunchPetShopWindow(); AutomationElement comboBox = window.Element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "petFoodInput")); Assert.IsAssignableFrom(typeof(SpecialComboBox), wrapperFactory.Wrap<SpecialComboBox>(comboBox, "Special Combo")); }
public void ShouldWrapThirdPartyExtensions() { var wrapperFactory = new WrapperFactory(); Window window = LaunchPetShopWindow(); AutomationElement comboBox = window.Element.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "petFoodInput")); Assert.IsAssignableFrom(typeof(SpecialComboBox), wrapperFactory.Wrap <SpecialComboBox>(comboBox, "Special Combo")); }
public void ShouldWrapElementsUsingTheGivenTypeOfWrapper() { var wrapperFactory = new WrapperFactory(); var anElement = AutomationElement.RootElement; Assert.IsAssignableFrom(typeof(TextBox), wrapperFactory.Wrap<TextBox>(anElement, "aTextBox")); Assert.IsAssignableFrom(typeof(RichTextBox), wrapperFactory.Wrap<RichTextBox>(anElement, "aRichTextBox")); Assert.IsAssignableFrom(typeof(ListBox), wrapperFactory.Wrap<ListBox>(anElement, "aListBox")); Assert.IsAssignableFrom(typeof(Button), wrapperFactory.Wrap<Button>(anElement, "aButton")); Assert.IsAssignableFrom(typeof(TextBlock), wrapperFactory.Wrap<TextBlock>(anElement, "aTextBlock")); Assert.IsAssignableFrom(typeof(Label), wrapperFactory.Wrap<Label>(anElement, "aLabel")); Assert.IsAssignableFrom(typeof(Tab), wrapperFactory.Wrap<Tab>(anElement, "aTab")); Assert.IsAssignableFrom(typeof(CheckBox), wrapperFactory.Wrap<CheckBox>(anElement, "aCheckBox")); Assert.IsAssignableFrom(typeof(RadioButton), wrapperFactory.Wrap<RadioButton>(anElement, "aRadioButton")); }
public void ShouldWrapElementsUsingTheGivenTypeOfWrapper() { var wrapperFactory = new WrapperFactory(); var anElement = AutomationElement.RootElement; Assert.IsAssignableFrom(typeof(TextBox), wrapperFactory.Wrap <TextBox>(anElement, "aTextBox")); Assert.IsAssignableFrom(typeof(RichTextBox), wrapperFactory.Wrap <RichTextBox>(anElement, "aRichTextBox")); Assert.IsAssignableFrom(typeof(ListBox), wrapperFactory.Wrap <ListBox>(anElement, "aListBox")); Assert.IsAssignableFrom(typeof(Button), wrapperFactory.Wrap <Button>(anElement, "aButton")); Assert.IsAssignableFrom(typeof(TextBlock), wrapperFactory.Wrap <TextBlock>(anElement, "aTextBlock")); Assert.IsAssignableFrom(typeof(Label), wrapperFactory.Wrap <Label>(anElement, "aLabel")); Assert.IsAssignableFrom(typeof(Tab), wrapperFactory.Wrap <Tab>(anElement, "aTab")); Assert.IsAssignableFrom(typeof(CheckBox), wrapperFactory.Wrap <CheckBox>(anElement, "aCheckBox")); Assert.IsAssignableFrom(typeof(RadioButton), wrapperFactory.Wrap <RadioButton>(anElement, "aRadioButton")); }
public ConventionWrapper GetConventionWrapper(string id) { if (id.StartsWith("conventions/") == false) { id = "conventions/" + id; } using var session = _holder.Store.OpenSession(); var convention = session .Include <Convention>(x => x.DayIds) .Include <Convention>(x => x.HallIds) .Include <Convention>(x => x.TicketIds) .Load <Convention>(id); var wrapperFactory = new WrapperFactory(session); return(wrapperFactory.Wrap(convention)); }
public ConventionManagementViewModel BuildConventionList(IDisplayPagination pagination) { var result = new ConventionManagementViewModel(); var conventions = Session .Query <Convention>() .Include(x => x.DayIds) .Include(x => x.HallIds) .Include(x => x.TicketIds) .Statistics(out var stats) .OrderByDescending(x => x.CreateTimeStamp) .Skip(pagination.SkipCount) .Take(pagination.ResultsPerPage) .ToList(); var wrapperFactory = new WrapperFactory(Session); result.Conventions = wrapperFactory.Wrap(conventions); result.Pagination = DisplayPagination.BuildForView(stats.TotalResults, pagination.SkipCount, pagination.ResultsPerPage); return(result); }
public ParticipantsManagementViewModel BuildSearchIndex(IDisplayPagination pagination, bool allowHistory = false, string searchWords = "") { if (searchWords.IsEmptyString()) { return(new ParticipantsManagementViewModel()); } var query = Session.Query <Participants_BySearchQuery.Result, Participants_BySearchQuery>() .Include(x => x.ParticipantId) .Include(x => x.ConventionId) .Statistics(out var stats) .Search(x => x.SearchText, searchWords).AsQueryable(); if (allowHistory == false) { query = query.Where(x => x.ConventionId == Actor.ManagedConvention.ConventionId); } var results = query .OrderBy(x => x.FullName) .Skip(pagination.SkipCount) .Take(pagination.ResultsPerPage) .As <ConventionEngagement>() .ToList(); var wrapperFactory = new WrapperFactory(Session); var viewModel = new ParticipantsManagementViewModel { Pagination = DisplayPagination.BuildForView( stats.TotalResults, pagination.SkipCount, pagination.ResultsPerPage), Engagements = wrapperFactory.Wrap(results, false), filters = new ParticipantsManagementViewModel.Filters() }; return(viewModel); }
public PersonalViewModel BuildPersonalViewModel() { var currentConvention = Actor.DisplayConvention.ConventionId; var currentUser = Actor.Me.Id; var myEngagement = Session.Query <ConventionEngagement>() .Include(x => x.ConventionId) .Include(x => x.ParticipantId) .Include(x => x.EventIds) .Include(x => x.SuggestedEventIds) .FirstOrDefault(x => x.ConventionId == currentConvention && x.ParticipantId == currentUser); var myRelatedEngagements = Session.Query <ConventionEngagement>() .Include(x => x.ParticipantId) .Include(x => x.EventIds) .Where(x => x.CreatorId == currentUser && x.ParticipantId != currentUser && x.ConventionId == currentConvention) .ToList(); if (myEngagement == null) { myEngagement = new ConventionEngagement { CreatorId = currentUser, ParticipantId = currentUser, ConventionId = currentConvention, ConventionStartDate = Actor.DisplayConvention.Days .Min(x => x.Date) .ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), IsLongTerm = true, }; Session.Store(myEngagement); Session.SaveChanges(); } var allEvents = myEngagement.EventIds; allEvents.AddRange(myEngagement.SuggestedEventIds); var allParticipants = new List <string>(); foreach (var myRelatedEngagement in myRelatedEngagements) { allParticipants.Add(myRelatedEngagement.ParticipantId); allEvents.AddRange(myRelatedEngagement.EventIds); } // Preload Events Session .Include <Event>(x => x.ConventionDayId) .Load <Event>(allEvents); var result = new PersonalViewModel(); var wrapperFactory = new WrapperFactory(Session); result.MyEngagement = wrapperFactory.Wrap(myEngagement); result.RelatedEngagements = wrapperFactory.Wrap(myRelatedEngagements); return(result); }