public void TestAddRange() { var list = new List<string> { "aaa", "bbb", "ccc" }; var set = new ObservableList<string>(list); Assert.AreEqual(set.Count, list.Count); bool propertyChangedInvoked = false; bool collectionChangedInvoked = false; set.PropertyChanged += (sender, e) => { Assert.AreEqual(e.PropertyName, nameof(ObservableList<string>.Count)); propertyChangedInvoked = true; }; set.CollectionChanged += (sender, e) => { Assert.AreEqual(e.Action, NotifyCollectionChangedAction.Add); Assert.AreEqual(e.NewStartingIndex, 3); Assert.NotNull(e.NewItems); Assert.AreEqual(e.NewItems.Count, 2); Assert.AreEqual(e.NewItems[0], "ddd"); Assert.AreEqual(e.NewItems[1], "eee"); collectionChangedInvoked = true; }; set.AddRange(new[] { "ddd", "eee" }); Assert.AreEqual(set.Count, 5); Assert.AreEqual(set[0], "aaa"); Assert.AreEqual(set[1], "bbb"); Assert.AreEqual(set[2], "ccc"); Assert.AreEqual(set[3], "ddd"); Assert.AreEqual(set[4], "eee"); Assert.True(propertyChangedInvoked); Assert.True(collectionChangedInvoked); }
private object _busysem = new object(); // semaphore #endregion Fields #region Constructors public SerialConnTest() { ADCValues = new ObservableList<VoltPoint>(); Connection = (Application.Current as App).CurrentSerialConnection; RCUCom = new RCUCommunication(Connection); RCUCom.ProgressChanged += RaiseProgressChanged; }
private void OnReportingCompleted(ObservableList<PendingReport>.ListChangedEventArgs e, ResultCompletionEventArgs args) { if (e.Item.ReportCompletedCallback != null) { e.Item.ReportCompletedCallback(e.Item.Exception, args.WasCancelled); } }
public void CanAccumulate() { var items = new ObservableList<Person>(); var subscription = items.Changes .Subscribe(changes => { Console.WriteLine(changes); }); using (var x = items.SuspendNotifications()) { foreach (var person in _random.Take(20000)) { items.Add(person); } items.Clear(); var result = items.GetChanges(); items[10] = new Person("Roland", 1); } }
public void LongNames() { var config = new List<int>() {2, 2, 2, 2, 2, 2, 2, 2, 2}; nodes = GenerateTreeNodes(config, isExpanded: true); Tree.Nodes = nodes; }
public void Test10K() { var config = new List<int>() {10, 10, 10, 10}; nodes = GenerateTreeNodes(config, isExpanded: true); Tree.Nodes = nodes; }
public void AddRangeNotifiesAsResetInsteadOfIndividualItemsWhenItemCountAboveThresholdTest(int lowerLimit, int upperLimit) { // given var rangeToAdd = Enumerable.Range(lowerLimit, upperLimit - lowerLimit + 1).ToList(); var testScheduler = new TestScheduler(); var testObserverCollectionChanges = testScheduler.CreateObserver<IObservableCollectionChange<int>>(); var testObserverResets = testScheduler.CreateObserver<Unit>(); using (var observableList = new ObservableList<int>()) { // when observableList.ThresholdAmountWhenChangesAreNotifiedAsReset = 0; observableList.CollectionChanges.Subscribe(testObserverCollectionChanges); observableList.Resets.Subscribe(testObserverResets); testScheduler.Schedule(TimeSpan.FromTicks(100), () => { observableList.AddRange(rangeToAdd); }); testScheduler.Start(); // then var shouldBeReset = rangeToAdd.Count >= observableList.ThresholdAmountWhenChangesAreNotifiedAsReset; testObserverCollectionChanges.Messages.Count.Should().Be(shouldBeReset ? 1 : rangeToAdd.Count); testObserverCollectionChanges.Messages.Should() .Match(recordedMessages => recordedMessages.All(message => message.Value.Value.ChangeType == (shouldBeReset ? ObservableCollectionChangeType.Reset : ObservableCollectionChangeType.ItemAdded))); testObserverResets.Messages.Count.Should().Be(shouldBeReset ? 1 : 0); } }
public ListCollectionView (IList collection) : base (collection) { var interfaces = SourceCollection.GetType ().GetInterfaces (); foreach (var t in interfaces) { if (t.IsGenericType && t.GetGenericTypeDefinition () == typeof (IList<>)) { Type type = t.GetGenericArguments () [0]; ItemConstructor = type.GetConstructor (Type.EmptyTypes); } } UpdateCanAddNewAndRemove (); filteredList = new ObservableList<object> (); RootGroup = new RootCollectionViewGroup (null, null, 0, false, SortDescriptions); CurrentPosition = -1; IsEmpty = ActiveList.Count == 0; MoveCurrentToPosition (0); if (SourceCollection is INotifyCollectionChanged) ((INotifyCollectionChanged) SourceCollection).CollectionChanged += HandleSourceCollectionChanged; GroupDescriptions.CollectionChanged += (o, e) => Refresh (); ((INotifyCollectionChanged) SortDescriptions).CollectionChanged += (o, e) => { if (IsAddingNew || IsEditingItem) throw new InvalidOperationException ("Cannot modify SortDescriptions while adding or editing an item"); Refresh (); }; filteredList.CollectionChanged += HandleFilteredListCollectionChanged; RootGroup.CollectionChanged += HandleRootGroupCollectionChanged; }
public LocationsTreeViewModel(ObservableCollection<Location> locations) { Locations = new ObservableList<LocationNode>(); foreach (var location in locations) Locations.Add(new LocationNode(location)); locations.CollectionChanged += (s, e) => { switch (e.Action) { case NotifyCollectionChangedAction.Add: foreach (Location location in e.NewItems) Locations.Add(new LocationNode(location)); break; case NotifyCollectionChangedAction.Remove: foreach (Location location in e.OldItems) { var item = Locations.FirstOrDefault(l => l.Location.Guid == location.Guid); if (item != null) Locations.Remove(item); } break; case NotifyCollectionChangedAction.Replace: foreach (Location location in e.OldItems) { var item = Locations.FirstOrDefault(l => l.Location.Guid == location.Guid); if (item != null) Locations.Remove(item); } foreach (Location location in e.NewItems) Locations.Add(new LocationNode(location)); break; case NotifyCollectionChangedAction.Reset: Locations.Clear(); foreach (Location location in e.NewItems) Locations.Add(new LocationNode(location)); break; } }; LocationsTreeViewSource = new CollectionViewSource { Source = Locations }; LocationsTreeViewSource.SortDescriptions.Add(new SortDescription("Location.Name", ListSortDirection.Ascending)); }
private void AddHousesListListeners(ObservableList<House> child) { if (child == null) return; var notifyPropertyChanging = child as INotifyPropertyChanging; // ReSharper disable ConditionIsAlwaysTrueOrFalse if (notifyPropertyChanging != null) // ReSharper restore ConditionIsAlwaysTrueOrFalse notifyPropertyChanging.PropertyChanging += HousesListPropertyChangingEventHandler; var notifyPropertyChanged = child as INotifyPropertyChanged; // ReSharper disable ConditionIsAlwaysTrueOrFalse if (notifyPropertyChanged != null) // ReSharper restore ConditionIsAlwaysTrueOrFalse notifyPropertyChanged.PropertyChanged += HousesListPropertyChangedEventHandler; var notifyChildPropertyChanged = child as INotifyCollectionChanged; // ReSharper disable ConditionIsAlwaysTrueOrFalse if (notifyChildPropertyChanged != null) // ReSharper restore ConditionIsAlwaysTrueOrFalse notifyChildPropertyChanged.CollectionChanged += HousesListChangedEventHandler; foreach (var item in child) AddHousesItemListeners(item); }
ObservableList<TreeNode<ITreeViewSampleItem>> Data2Country(List<TreeViewSampleDataCountry> data) { var countries = new ObservableList<TreeNode<ITreeViewSampleItem>>(); data.ForEach(x => countries.Add(Node(new TreeViewSampleItemCountry(x.Name, x.Flag)))); return countries; }
public Project() { // Default projects details = new ProjectDetails (); buttons = new ObservableList <ButtonProjectElement> (); elements = new List <ProjectElement> (); }
void Click() { if (click==0) { items = listView.DataSource; items.Add("Added from script 0"); items.Add("Added from script 1"); items.Add("Added from script 2"); items.Remove("Caster"); click += 1; return ; } if (click==1) { items.Clear(); click += 1; return ; } if (click==2) { items.Add("test"); click += 1; return ; } }
public TagLineListForm(IServiceProvider provider, IEnumerable<TagLineInfo> tagLines) { if (provider == null) throw new ArgumentNullException(nameof(provider)); if (tagLines == null) throw new ArgumentNullException(nameof(tagLines)); _serviceManager = new ServiceContainer(provider); _tagLines = new ObservableList<TagLineInfo>(tagLines); InitializeComponent(); _serviceManager.Publish<ITagLineListFormService>(new TagLineListFormService(this)); _serviceManager.Publish<IDefaultCommandService>(new DefaultCommandService("Janus.Forum.TagLine.Edit")); _toolbarGenerator = new StripMenuGenerator(_serviceManager, _toolStrip, "Forum.TagLine.Toolbar"); _contextMenuGenerator = new StripMenuGenerator(_serviceManager, _contextMenuStrip, "Forum.TagLine.ContextMenu"); _listImages.Images.Add( _serviceManager.GetRequiredService<IStyleImageManager>() .GetImage(@"MessageTree\Msg", StyleImageType.ConstSize)); UpdateData(); _tagLines.Changed += (sender, e) => UpdateData(); }
public FilteredPhotoModel(Windows.Storage.StorageFile file, ObservableList<Filter> filters) { _photo = new PhotoModel(file); Filters = filters; Filters.ItemsChanged += Filters_ItemsChanged; }
public void CanHaveManyComputeds() { var prefix = new Observable<string>("Before"); var contacts = new ObservableList<Contact>( Enumerable.Range(0, 10000) .Select(i => new Contact() { FirstName = "FirstName" + i, LastName = "LastName" + i })); var projections = new ComputedList<Projection>(() => from c in contacts select new Projection(prefix, c)); string dummy; foreach (var projection in projections) dummy = projection.Name; Assert.AreEqual("BeforeFirstName3LastName3", projections.ElementAt(3).Name); prefix.Value = "After"; foreach (var projection in projections) dummy = projection.Name; Assert.AreEqual("AfterFirstName3LastName3", projections.ElementAt(3).Name); }
public void AddRange_FiresCollectionChanged() { var list = new ObservableList<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int eventFireCount = 0; list.CollectionChanged += (sender, args) => { eventFireCount++; Assert.AreEqual(NotifyCollectionChangedAction.Add, args.Action); switch (eventFireCount) { case 1: Assert.AreEqual(9, args.NewStartingIndex); Assert.IsTrue(new[] { 10 }.SequenceEqual(args.NewItems.Cast<int>())); break; case 2: Assert.AreEqual(10, args.NewStartingIndex); Assert.IsTrue(new[] { 11 }.SequenceEqual(args.NewItems.Cast<int>())); break; } }; list.AddRange(new[] { 10, 11 }); }
public SoftphoneEngine() { _sync = new object(); // set license here PhoneLines = new ObservableList<IPhoneLine>(); PhoneCalls = new ObservableList<IPhoneCall>(); LogEntries = new ObservableList<LogEntry>(); InstantMessages = new ObservableList<string>(); CallHistory = new CallHistory(); CallTypes = new List<CallType> { CallType.Audio, CallType.AudioVideo }; // enable file logging InitLogger(); // create softphone MinPort = 20000; MaxPort = 20500; //LocalIP = SoftPhoneFactory.GetLocalIP(); InitSoftphone(false); // create media MediaHandlers = new MediaHandlers(); MediaHandlers.Init(); }
public SoftphoneEngine(bool IsToRegister=true) { // set license here PhoneLines = new ObservableList<IPhoneLine>(); PhoneCalls = new ObservableList<IPhoneCall>(); InstantMessages = new ObservableList<string>(); CallHistory = new CallHistory(); CallTypes = new List<CallType> {CallType.Audio, CallType.AudioVideo}; AccountModel = new AccountModel() { DisplayName = Properties.Settings.Default.DisplayName, RegisterName = Properties.Settings.Default.RegisterName, Domain = Properties.Settings.Default.Domain, UserName = Properties.Settings.Default.UserName, OutboundProxy = Properties.Settings.Default.OutboundProxy, Password = Properties.Settings.Default.Password }; // create softphone MinPort = 20000; MaxPort = 20500; //LocalIP = SoftPhoneFactory.GetLocalIP(); InitSoftphone(false); // create media MediaHandlers = new MediaHandlers(); MediaHandlers.Init(); if (IsToRegister) { RegisterLine(); } }
public void TestAccessSingleValue() { var property = new ObservableList<int>(5, 2, 7); var computed = new ComputedObservable<int>(() => property[2] + 1); Assert.AreEqual(8, computed.Value); property[2] = 10; Assert.AreEqual(11, computed.Value); }
public void ObservableListExtensions_All_ReturnsTrueIfObservableListIsEmpty() { var list = new ObservableList<Int32>(); var result = list.All(x => x % 2 == 0); TheResultingValue(result).ShouldBe(true); }
public void ObservableListExtensions_All_ReturnsFalseIfOneItemDoesNotMatchPredicate() { var list = new ObservableList<Int32>() { 1, 2, 4, 6 }; var result = list.All(x => x % 2 == 0); TheResultingValue(result).ShouldBe(false); }
public void ObservableListExtensions_Any_ReturnsFalseIfObservableListDoesNotContainItems() { var list = new ObservableList<Int32>(); var result = list.Any(); TheResultingValue(result).ShouldBe(false); }
public void ObservableListExtensions_All_ReturnsTrueIfAllItemsMatchPredicate() { var list = new ObservableList<Int32>() { 2, 4, 6 }; var result = list.All(x => x % 2 == 0); TheResultingValue(result).ShouldBe(true); }
//[UsedImplicitly] PropertyObserver<DataAxisViewModel> _propertyObserver; public DataAxisViewModel() { DataRange = new RangeCollection(); Label = "Axis"; AxisTicks = new ObservableList<DataAxisTick>(); AxisMarkers = new ObservableList<DataAxisTick>(); VisibleRange = new Range(1, 2); }
public void ObservableListExtensions_Any_ReturnsTrueIfObservableListContainsItems() { var list = new ObservableList<Int32>() { 1 }; var result = list.Any(); TheResultingValue(result).ShouldBe(true); }
/// <summary> /// Constructor that allows a custom binding to be supplied. /// </summary> /// <param name="imageSets"></param> /// <param name="primaryStudyInstanceUid"></param> /// <param name="binding"></param> public ImageSetTree(ObservableList<IImageSet> imageSets, string primaryStudyInstanceUid, ImageSetTreeItemBinding binding) { _primaryStudyInstanceUid = primaryStudyInstanceUid; _imageSetGroups = new ImageSetGroups(imageSets); _internalTree = new ImageSetTreeGroupItem(_imageSetGroups.Root, new StudyDateComparer(), binding); UpdateInternalTreeRoot(); _internalTree.Updated += OnInternalTreeUpdated; }
public void ObservableListExtensions_Count_ReturnsCorrectSize() { var list = new ObservableList<Int32>() { 1, 2, 3 }; var result = list.Count(); TheResultingValue(result).ShouldBe(3); }
public void AddRange_ItemCountOverThresHold_FiresCollectionChanged() { var list = new ObservableList<int> { 1, 2, 3, 4, 5 }; list.CollectionChanged += (sender, args) => Assert.AreEqual(NotifyCollectionChangedAction.Reset, args.Action); list.AddRange(new[] { 6, 7, 8, 9, 10 }); }
public void ObservableListExtensions_AnyWithPredicate_ReturnsTrueIfObservableListContainsMatchingItems() { var list = new ObservableList<Int32>() { 1, 2, 3 }; var result = list.Any(x => x % 2 == 0); TheResultingValue(result).ShouldBe(true); }
public void FindItemsByReflection(RepositoryItemBase OriginItemObject, RepositoryItemBase item, ObservableList <FoundItem> foundItemsList, string textToFind, SearchConfig searchConfig, RepositoryItemBase parentItemToSave, string itemParent, string foundField) { var properties = item.GetType().GetMembers().Where(x => x.MemberType == MemberTypes.Property || x.MemberType == MemberTypes.Field); foreach (MemberInfo mi in properties) { try { if (mi.Name == nameof(ActInputValue.StoreToVariable) || mi.Name == /*nameof(RepositoryItemBase.mBackupDic)*/ "mBackupDic" || mi.Name == nameof(RepositoryItemBase.FileName) || mi.Name == nameof(RepositoryItemBase.Guid) || mi.Name == nameof(RepositoryItemBase.ObjFolderName) || mi.Name == nameof(RepositoryItemBase.ObjFileExt) || mi.Name == "ScreenShots" || mi.Name == nameof(RepositoryItemBase.ContainingFolder) || mi.Name == nameof(RepositoryItemBase.ContainingFolderFullPath) || mi.Name == nameof(RepositoryItemBase.Guid) || mi.Name == nameof(RepositoryItemBase.ParentGuid) || mi.Name == "Created" || mi.Name == "Version" || mi.Name == "CreatedBy" || mi.Name == "LastUpdate" || mi.Name == "LastUpdateBy") { continue; } //Get the attr value PropertyInfo PI = item.GetType().GetProperty(mi.Name); if (mi.MemberType == MemberTypes.Property) { var token = PI.GetCustomAttribute(typeof(IsSerializedForLocalRepositoryAttribute)); if (token == null) { continue; } } else if (mi.MemberType == MemberTypes.Field) { var token = item.GetType().GetField(mi.Name).GetCustomAttribute(typeof(IsSerializedForLocalRepositoryAttribute)); if (token == null) { continue; } } if (PI != null && (PI.PropertyType == typeof(DateTime) || PI.PropertyType == typeof(Guid))) { continue; } dynamic value = null; try { if (mi.MemberType == MemberTypes.Property) { value = PI.GetValue(item); } else if (mi.MemberType == MemberTypes.Field) { value = item.GetType().GetField(mi.Name).GetValue(item); } } catch { continue; } if (value == null) { continue; } if (value is IObservableList) { string foundListField = string.Empty; if (string.IsNullOrEmpty(foundField)) { foundListField = mi.Name; } else { foundListField = foundField + @"\" + mi.Name; } int index = 0; foreach (RepositoryItemBase o in value) { index++; string paramNameString = string.Empty; if (o is RepositoryItemBase) { paramNameString = ((RepositoryItemBase)o).ItemName; } else { paramNameString = o.ToString(); } string foundListFieldValue = string.Format(@"{0}[{1}]\{2}", foundListField, index, paramNameString); FindItemsByReflection(OriginItemObject, o, foundItemsList, textToFind, searchConfig, parentItemToSave, itemParent, foundListFieldValue); } } else if (value is RepositoryItemBase)//!RegularTypeList.Contains(value.GetType().Name) && value.GetType().BaseType.Name != nameof(Enum) && value.GetType().Name != "Bitmap" && value.GetType().Name != nameof(Guid) && value.GetType().Name != nameof(RepositoryItemKey)) { //TODO taking care of List which is not iobservableList if (string.IsNullOrEmpty(foundField)) { foundField = @"\" + mi.Name; } else { foundField = foundField + @"\" + mi.Name; } FindItemsByReflection(OriginItemObject, value, foundItemsList, textToFind, searchConfig, parentItemToSave, itemParent, foundField); } else { if (value != null) { try { string stringValue = value.ToString(); string matchedStringValue = string.Empty; if (searchConfig.MatchCase == false) { matchedStringValue = stringValue.ToUpper(); textToFind = textToFind.ToUpper(); } else { matchedStringValue = stringValue; } if ((searchConfig.MatchAllWord == true && matchedStringValue == textToFind) || (searchConfig.MatchAllWord == false && matchedStringValue.Contains(textToFind)) /* || new Regex(textToFind).Match(stringValue).Success == true*/) //Comment out until fixing Regex search { string finalFoundFieldPath = string.Empty; if (string.IsNullOrEmpty(foundField)) { finalFoundFieldPath = mi.Name; } else { finalFoundFieldPath = foundField + @"\" + mi.Name; } FoundItem foundItem = foundItemsList.Where(x => x.FieldName == mi.Name && x.FieldValue == stringValue && x.ItemObject == item).FirstOrDefault(); if (foundItem == null) { List <string> OptionalValuseToReplaceList = new List <string>(); if (PI.PropertyType.BaseType == typeof(Enum)) { Array enumValues = Enum.GetValues(PI.PropertyType); for (int i = 0; i < enumValues.Length; i++) { object enumValue = enumValues.GetValue(i); OptionalValuseToReplaceList.Add(enumValue.ToString()); } } else if (PI.PropertyType == typeof(bool)) { OptionalValuseToReplaceList.Add("True"); OptionalValuseToReplaceList.Add("False"); } foundItemsList.Add(new FoundItem() { OriginObject = OriginItemObject, ItemObject = item, ParentItemToSave = parentItemToSave, FieldName = mi.Name, FieldValue = stringValue, ItemParent = itemParent, FoundField = finalFoundFieldPath, OptionalValuesToRepalce = OptionalValuseToReplaceList }); } else { } } } catch { } } } } catch { } } }
public bool TestElementLocators(ObservableList <ElementLocator> elementLocators, bool GetOutAfterFoundElement = false) { throw new NotImplementedException(); }
public override void Execute(ReportInfo RI) { string reportsResultFolder = string.Empty; HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (WorkSpace.RunsetExecutor.RunSetConfig.RunsetExecLoggerPopulated) { string runSetFolder = string.Empty; if (WorkSpace.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null) { runSetFolder = WorkSpace.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder; AutoLogProxy.UserOperationStart("Online Report"); } else { runSetFolder = ExecutionLogger.GetRunSetLastExecutionLogFolderOffline(); AutoLogProxy.UserOperationStart("Offline Report"); } if (!string.IsNullOrEmpty(selectedHTMLReportTemplateID.ToString())) { ObservableList <HTMLReportConfiguration> HTMLReportConfigurations = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>(); if ((isHTMLReportFolderNameUsed) && (HTMLReportFolderName != null) && (HTMLReportFolderName != string.Empty)) { string currentHTMLFolderName = string.Empty; if (!isHTMLReportPermanentFolderNameUsed) { currentHTMLFolderName = HTMLReportFolderName + "\\" + System.IO.Path.GetFileName(runSetFolder); } else { currentHTMLFolderName = HTMLReportFolderName; } reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, HTMLReportConfigurations.Where(x => (x.ID == selectedHTMLReportTemplateID)).FirstOrDefault(), currentHTMLFolderName, isHTMLReportPermanentFolderNameUsed, currentConf.HTMLReportConfigurationMaximalFolderSize); } else { reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, HTMLReportConfigurations.Where(x => (x.ID == selectedHTMLReportTemplateID)).FirstOrDefault(), null, isHTMLReportPermanentFolderNameUsed); } } else { reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, null, null, isHTMLReportPermanentFolderNameUsed); } } else { Errors = "In order to get HTML report, please, perform executions before"; Reporter.CloseGingerHelper(); Status = Ginger.Run.RunSetActions.RunSetActionBase.eRunSetActionStatus.Failed; return; } }
public AttributeConstraint() { this._values = new ObservableList <string>(); this._values.CollectionChanging += this.ValuesCollectionChanging; this._values.CollectionChanged += this.ValuesCollectionChanged; }
public void StartDriver() { mIsStarting = true; OnPropertyChanged(Fields.Status); try { try { if (Remote) { throw new Exception("Remote is Obsolete, use GingerGrid"); //We pass the agent info } else { switch (DriverType) { case eDriverType.InternalBrowser: Driver = new InternalBrowser(BusinessFlow); break; case eDriverType.SeleniumFireFox: Driver = new SeleniumDriver(GingerCore.Drivers.SeleniumDriver.eBrowserType.FireFox); break; case eDriverType.SeleniumChrome: Driver = new SeleniumDriver(GingerCore.Drivers.SeleniumDriver.eBrowserType.Chrome); break; case eDriverType.SeleniumIE: Driver = new SeleniumDriver(GingerCore.Drivers.SeleniumDriver.eBrowserType.IE); break; case eDriverType.SeleniumRemoteWebDriver: Driver = new SeleniumDriver(GingerCore.Drivers.SeleniumDriver.eBrowserType.RemoteWebDriver); // set capabilities if (DriverConfiguration == null) { DriverConfiguration = new ObservableList <DriverConfigParam>(); } ((SeleniumDriver)Driver).RemoteGridHub = GetParamValue(SeleniumDriver.RemoteGridHubParam); ((SeleniumDriver)Driver).RemoteBrowserName = GetParamValue(SeleniumDriver.RemoteBrowserNameParam); ((SeleniumDriver)Driver).RemotePlatform = GetParamValue(SeleniumDriver.RemotePlatformParam); ((SeleniumDriver)Driver).RemoteVersion = GetParamValue(SeleniumDriver.RemoteVersionParam); break; case eDriverType.SeleniumEdge: Driver = new SeleniumDriver(GingerCore.Drivers.SeleniumDriver.eBrowserType.Edge); break; case eDriverType.SeleniumPhantomJS: Driver = new SeleniumDriver(GingerCore.Drivers.SeleniumDriver.eBrowserType.PhantomJS); break; case eDriverType.ASCF: Driver = new ASCFDriver(BusinessFlow, Name); break; case eDriverType.DOSConsole: Driver = new DOSConsoleDriver(BusinessFlow); break; case eDriverType.UnixShell: Driver = new UnixShellDriver(BusinessFlow, ProjEnvironment); ((UnixShellDriver)Driver).SetScriptsFolder(SolutionFolder + @"\Documents\sh\"); break; case eDriverType.MobileAppiumAndroid: Driver = new SeleniumAppiumDriver(SeleniumAppiumDriver.eSeleniumPlatformType.Android, BusinessFlow); break; case eDriverType.MobileAppiumIOS: Driver = new SeleniumAppiumDriver(SeleniumAppiumDriver.eSeleniumPlatformType.iOS, BusinessFlow); break; case eDriverType.MobileAppiumAndroidBrowser: Driver = new SeleniumAppiumDriver(SeleniumAppiumDriver.eSeleniumPlatformType.AndroidBrowser, BusinessFlow); break; case eDriverType.MobileAppiumIOSBrowser: Driver = new SeleniumAppiumDriver(SeleniumAppiumDriver.eSeleniumPlatformType.iOSBrowser, BusinessFlow); break; case eDriverType.PerfectoMobile: Driver = new PerfectoDriver(BusinessFlow); break; case eDriverType.WebServices: WebServicesDriver WebServicesDriver = new WebServicesDriver(BusinessFlow); Driver = WebServicesDriver; break; case eDriverType.WindowsAutomation: Driver = new WindowsDriver(BusinessFlow); break; case eDriverType.FlaUIWindow: Driver = new WindowsDriver(BusinessFlow, UIAutomationDriverBase.eUIALibraryType.FlaUI); break; case eDriverType.PowerBuilder: Driver = new PBDriver(BusinessFlow); break; case eDriverType.FlaUIPB: Driver = new PBDriver(BusinessFlow, UIAutomationDriverBase.eUIALibraryType.FlaUI); break; case eDriverType.JavaDriver: Driver = new JavaDriver(BusinessFlow); break; case eDriverType.MainFrame3270: Driver = new MainFrameDriver(BusinessFlow); break; case eDriverType.AndroidADB: string DeviceConfigFolder = GetOrCreateParam("DeviceConfigFolder").Value; if (!string.IsNullOrEmpty(DeviceConfigFolder)) { Driver = new AndroidADBDriver(BusinessFlow, SolutionFolder + @"\Documents\Devices\" + DeviceConfigFolder + @"\"); } else { //TODO: Load create sample folder/device, or start the wizard throw new Exception("Please set device config folder"); } break; //TODO: default mess } } } catch (Exception e) { System.Windows.MessageBox.Show(e.Message); } Driver.BusinessFlow = this.BusinessFlow; SetDriverConfiguration(); //if STA we need to start it on seperate thread, so UI/Window can be refreshed: Like IB, Mobile, Unix if (Driver.IsSTAThread()) { CTS = new CancellationTokenSource(); MSTATask = new Task(() => { Driver.StartDriver(); }, CTS.Token, TaskCreationOptions.LongRunning); MSTATask.Start(); } else { Driver.StartDriver(); } } finally { // Give the driver time to start Thread.Sleep(500); mIsStarting = false; Driver.IsDriverRunning = true; OnPropertyChanged(Fields.Status); Driver.driverMessageEventHandler += driverMessageEventHandler; OnPropertyChanged(Fields.IsWindowExplorerSupportReady); } }
public override void ExportBfActivitiesGroupsToALM(BusinessFlow businessFlow, ObservableList <ActivitiesGroup> grdActivitiesGroups) { if (businessFlow == null) { return; } if (businessFlow.ActivitiesGroups.Count == 0) { Reporter.ToUser(eUserMsgKeys.NoItemWasSelected); return; } bool exportRes; string res = string.Empty; Reporter.ToGingerHelper(eGingerHelperMsgKey.ExportItemToALM, null, "Selected Activities Groups"); exportRes = ((RallyCore)ALMIntegration.Instance.AlmCore).ExportBfActivitiesGroupsToALM(businessFlow, grdActivitiesGroups, ref res); if (exportRes) { //Check if we need to perform save Reporter.ToUser(eUserMsgKeys.ExportItemToALMSucceed); } else { Reporter.ToUser(eUserMsgKeys.ExportItemToALMFailed, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), businessFlow.Name, res); } Reporter.CloseGingerHelper(); }
public bool ShowAsWindow(eWindowShowStyle windowStyle = eWindowShowStyle.Free, bool startupLocationWithOffset = false) { ObservableList <Button> winButtons = new ObservableList <Button>(); string[] varTypeElems = mVariable.GetType().ToString().Split('.'); string varType = varTypeElems[varTypeElems.Count() - 1]; string title = "Edit " + RemoveVariableWord(mVariable.VariableUIType) + " " + GingerDicser.GetTermResValue(eTermResKey.Variable); switch (editMode) { case VariableEditPage.eEditMode.BusinessFlow: case VariableEditPage.eEditMode.Activity: case VariableEditPage.eEditMode.Global: case VariableEditPage.eEditMode.View: Button okBtn = new Button(); okBtn.Content = "Ok"; okBtn.Click += new RoutedEventHandler(okBtn_Click); winButtons.Add(okBtn); break; case VariableEditPage.eEditMode.SharedRepository: title = "Edit Shared Repository " + RemoveVariableWord(mVariable.VariableUIType) + " " + GingerDicser.GetTermResValue(eTermResKey.Variable); Button saveBtn = new Button(); saveBtn.Content = "Save"; saveBtn.Click += new RoutedEventHandler(saveBtn_Click); winButtons.Add(saveBtn); break; case VariableEditPage.eEditMode.FindAndReplace: title = "Edit " + RemoveVariableWord(mVariable.VariableUIType) + " " + GingerDicser.GetTermResValue(eTermResKey.Variable); Button FindAndRepalceSaveBtn = new Button(); FindAndRepalceSaveBtn.Content = "Save"; FindAndRepalceSaveBtn.Click += new RoutedEventHandler(FindAndRepalceSaveBtn_Click); winButtons.Add(FindAndRepalceSaveBtn); break; } if (editMode != eEditMode.View) { Button undoBtn = new Button(); undoBtn.Content = "Undo & Close"; undoBtn.Click += new RoutedEventHandler(undoBtn_Click); winButtons.Add(undoBtn); if (!(mVariable is VariableString) && !(mVariable is VariableSelectionList) && !(mVariable is VariableDynamic)) { Button AutoValueBtn = new Button(); AutoValueBtn.Content = "Generate Auto Value"; AutoValueBtn.Click += new RoutedEventHandler(AutoValueBtn_Click); winButtons.Add(AutoValueBtn); } if (!(mVariable is VariableRandomString) && !(mVariable is VariableRandomNumber)) { Button resetBtn = new Button(); resetBtn.Content = "Reset Value"; resetBtn.Click += new RoutedEventHandler(resetBtn_Click); winButtons.Add(resetBtn); } } this.Height = 800; this.Width = 800; GingerCore.General.LoadGenericWindow(ref _pageGenericWin, App.MainWindow, windowStyle, title, this, winButtons, false, string.Empty, CloseWinClicked, startupLocationWithOffset: startupLocationWithOffset); return(saveWasDone); }
public GenericWindow(Window Owner, eWindowShowStyle windowStyle, string windowTitle, Page windowPage, ObservableList <Button> windowBtnsList = null, bool showClosebtn = true, string closeBtnText = "Close", RoutedEventHandler closeEventHandler = null) { InitializeComponent(); this.Owner = Owner; CurrentWindow = this; //set style CurrentWinStyle = windowStyle; if (CurrentWinStyle == eWindowShowStyle.Dialog) { PinBtn.Visibility = System.Windows.Visibility.Visible; } else { PinBtn.Visibility = System.Windows.Visibility.Collapsed; } NeedToReShow = false; //set title winTitle.Content = windowTitle; //set size if (windowStyle == eWindowShowStyle.FreeMaximized) { this.WindowState = System.Windows.WindowState.Maximized; } else { if (windowPage != null) { double widthDelta = 20; double heightDelta = 100; //keep window min width & height if (windowPage.MinWidth > 0) { mPageOriginalWidth = windowPage.MinWidth; } else if (windowPage.Width > 0) { mPageOriginalWidth = windowPage.Width; } if (windowPage.MinHeight > 0) { mPageOriginalHeight = windowPage.MinHeight; } else if (windowPage.Height > 0) { mPageOriginalHeight = windowPage.Height; } if (mPageOriginalWidth == -1) { windowPage.Width = 600; mPageOriginalWidth = 600; } if (mPageOriginalHeight == -1) { windowPage.Height = this.Height; mPageOriginalHeight = this.Height; } //doing some user screen calculations double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; List <System.Windows.Forms.Screen> allScreens = System.Windows.Forms.Screen.AllScreens.ToList(); if (allScreens.Count > 1) { //take smallest screen size foreach (System.Windows.Forms.Screen scr in allScreens) { if (scr.Bounds.Width < screenWidth) { screenWidth = scr.Bounds.Width; } if (scr.Bounds.Height < screenHeight) { screenHeight = scr.Bounds.Height; } } } //fit page size to screen size if (Convert.ToString(windowPage.Tag) != "PageSizeWasModified") { if (windowPage.Width > 0) { windowPage.Width = ((windowPage.Width / 1280) * screenWidth);//relative to screen size } if (windowPage.Width > screenWidth) { windowPage.Width = screenWidth - widthDelta - 100; } if (windowPage.Height > 0) { windowPage.Height = ((windowPage.Height / 1024) * screenHeight);//relative to screen size } if (windowPage.Height > screenHeight) { windowPage.Height = screenHeight - heightDelta - 100; } if (windowPage.Tag == null) { windowPage.Tag = "PageSizeWasModified"; } } //set min height and width if (windowPage.MinWidth > 0) { if (windowPage.Width < windowPage.MinWidth) { if (windowPage.MinWidth > screenWidth) { windowPage.MinWidth = screenWidth - widthDelta - 100; } windowPage.Width = windowPage.MinWidth; } } if (windowPage.MinHeight > 0) { if (windowPage.Height < windowPage.MinHeight) { if (windowPage.MinHeight > screenHeight) { windowPage.MinHeight = screenHeight - heightDelta - 100; } windowPage.Height = windowPage.MinHeight; } } //set the window size based on page size this.Width = windowPage.Width + widthDelta; this.MinWidth = windowPage.MinWidth + widthDelta; this.Height = windowPage.Height + heightDelta; this.MinHeight = windowPage.MinHeight + heightDelta; } } //set page content if (windowPage != null) { PageFrame.Content = windowPage; } //set window buttons //close buttons handling mCloseEventHandler = closeEventHandler; if (!showClosebtn) { CloseBtn.Visibility = System.Windows.Visibility.Collapsed; if (mCloseEventHandler == null) { UpperCloseBtn.Visibility = System.Windows.Visibility.Collapsed; } } if (!string.IsNullOrEmpty(closeBtnText)) { CloseBtn.Content = closeBtnText; UpperCloseBtn.ToolTip = closeBtnText; } if (windowBtnsList != null) { foreach (Button btn in windowBtnsList) { btn.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; Thickness margin = btn.Margin; if (margin.Right < 10) { margin.Right = 10; } btn.Margin = margin; btn.Style = this.FindResource("$WindowButtonStyle") as Style; DockPanel.SetDock(btn, Dock.Right); BottomPanel.Children.Add(btn); } } }
public bool ExportBusinessFlowToALM(BusinessFlow businessFlow, TestSet mappedTestSet, string uploadPath, ObservableList <ExternalItemFieldBase> testSetFields, ref string result) { return(ExportToQC.ExportBusinessFlowToQC(businessFlow, mappedTestSet, uploadPath, testSetFields, ref result)); }
public async Task InitializeData(StringProvider stringProvider, string dataPath) { _stringProvider = stringProvider; StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(dataPath)); string dataString = await FileIO.ReadTextAsync(file); JsonObject rootObject = JsonObject.Parse(dataString); _whiteColor = new ColorPaletteEntry(Colors.White, _stringProvider.GetString("DarkThemeTextContrastTitle"), null, FluentEditorShared.Utils.ColorStringFormat.PoundRGB, null); _blackColor = new ColorPaletteEntry(Colors.Black, _stringProvider.GetString("LightThemeTextContrastTitle"), null, FluentEditorShared.Utils.ColorStringFormat.PoundRGB, null); var lightRegionNode = rootObject["LightRegion"].GetObject(); _lightRegion = ColorPaletteEntry.Parse(lightRegionNode, null); var darkRegionNode = rootObject["DarkRegion"].GetObject(); _darkRegion = ColorPaletteEntry.Parse(darkRegionNode, null); var lightBaseNode = rootObject["LightBase"].GetObject(); _lightBase = ColorPalette.Parse(lightBaseNode, null); var darkBaseNode = rootObject["DarkBase"].GetObject(); _darkBase = ColorPalette.Parse(darkBaseNode, null); var lightPrimaryNode = rootObject["LightPrimary"].GetObject(); _lightPrimary = ColorPalette.Parse(lightPrimaryNode, null); var darkPrimaryNode = rootObject["DarkPrimary"].GetObject(); _darkPrimary = ColorPalette.Parse(darkPrimaryNode, null); #region Message var messageForegroundNode = rootObject["MessageForeground"].GetObject(); _messageForeground = ColorPaletteEntry.Parse(messageForegroundNode, null); var messageForegroundOutNode = rootObject["MessageForegroundOut"].GetObject(); _messageForegroundOut = ColorPaletteEntry.Parse(messageForegroundOutNode, null); var messageBackgroundNode = rootObject["MessageBackground"].GetObject(); _messageBackground = ColorPaletteEntry.Parse(messageBackgroundNode, null); var messageBackgroundOutNode = rootObject["MessageBackgroundOut"].GetObject(); _messageBackgroundOut = ColorPaletteEntry.Parse(messageBackgroundOutNode, null); var messageSubtleLabelNode = rootObject["MessageSubtleLabel"].GetObject(); _messageSubtleLabel = ColorPaletteEntry.Parse(messageSubtleLabelNode, null); var messageSubtleLabelOutNode = rootObject["MessageSubtleLabelOut"].GetObject(); _messageSubtleLabelOut = ColorPaletteEntry.Parse(messageSubtleLabelOutNode, null); var messageSubtleGlyphNode = rootObject["MessageSubtleGlyph"].GetObject(); _messageSubtleGlyph = ColorPaletteEntry.Parse(messageSubtleGlyphNode, null); var messageSubtleGlyphOutNode = rootObject["MessageSubtleGlyphOut"].GetObject(); _messageSubtleGlyphOut = ColorPaletteEntry.Parse(messageSubtleGlyphOutNode, null); var messageSubtleForegroundNode = rootObject["MessageSubtleForeground"].GetObject(); _messageSubtleForeground = ColorPaletteEntry.Parse(messageSubtleForegroundNode, null); var messageSubtleForegroundOutNode = rootObject["MessageSubtleForegroundOut"].GetObject(); _messageSubtleForegroundOut = ColorPaletteEntry.Parse(messageSubtleForegroundOutNode, null); var messageHeaderForegroundNode = rootObject["MessageHeaderForeground"].GetObject(); _messageHeaderForeground = ColorPaletteEntry.Parse(messageHeaderForegroundNode, null); var messageHeaderForegroundOutNode = rootObject["MessageHeaderForegroundOut"].GetObject(); _messageHeaderForegroundOut = ColorPaletteEntry.Parse(messageHeaderForegroundOutNode, null); var messageHeaderBorderNode = rootObject["MessageHeaderBorder"].GetObject(); _messageHeaderBorder = ColorPaletteEntry.Parse(messageHeaderBorderNode, null); var messageHeaderBorderOutNode = rootObject["MessageHeaderBorderOut"].GetObject(); _messageHeaderBorderOut = ColorPaletteEntry.Parse(messageHeaderBorderOutNode, null); var messageMediaForegroundNode = rootObject["MessageMediaForeground"].GetObject(); _messageMediaForeground = ColorPaletteEntry.Parse(messageMediaForegroundNode, null); var messageMediaForegroundOutNode = rootObject["MessageMediaForegroundOut"].GetObject(); _messageMediaForegroundOut = ColorPaletteEntry.Parse(messageMediaForegroundOutNode, null); var messageMediaBackgroundNode = rootObject["MessageMediaBackground"].GetObject(); _messageMediaBackground = ColorPaletteEntry.Parse(messageMediaBackgroundNode, null); var messageMediaBackgroundOutNode = rootObject["MessageMediaBackgroundOut"].GetObject(); _messageMediaBackgroundOut = ColorPaletteEntry.Parse(messageMediaBackgroundOutNode, null); #endregion _presets = new ObservableList <Preset>(); if (rootObject.ContainsKey("Presets")) { var presetsNode = rootObject["Presets"].GetArray(); foreach (var presetNode in presetsNode) { _presets.Add(Preset.Parse(presetNode.GetObject())); } } if (_presets.Count >= 1) { ApplyPreset(_presets[0]); } UpdateActivePreset(); _lightRegion.ContrastColors = new List <ContrastColorWrapper>() { new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, true, true), new ContrastColorWrapper(_lightBase.BaseColor, true, false), new ContrastColorWrapper(_lightPrimary.BaseColor, true, false) }; _darkRegion.ContrastColors = new List <ContrastColorWrapper>() { new ContrastColorWrapper(_whiteColor, true, true), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkBase.BaseColor, true, false), new ContrastColorWrapper(_darkPrimary.BaseColor, true, false) }; _lightBase.ContrastColors = new List <ContrastColorWrapper>() { new ContrastColorWrapper(_whiteColor, false, false), new ContrastColorWrapper(_blackColor, true, true), new ContrastColorWrapper(_lightRegion, true, false), new ContrastColorWrapper(_lightPrimary.BaseColor, true, false) }; _darkBase.ContrastColors = new List <ContrastColorWrapper>() { new ContrastColorWrapper(_whiteColor, true, true), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion, true, false), new ContrastColorWrapper(_darkPrimary.BaseColor, true, false) }; _lightPrimary.ContrastColors = new List <ContrastColorWrapper>() { new ContrastColorWrapper(_whiteColor, true, true), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_lightRegion, true, false), new ContrastColorWrapper(_lightBase.BaseColor, true, false) }; _darkPrimary.ContrastColors = new List <ContrastColorWrapper>() { new ContrastColorWrapper(_whiteColor, true, true), new ContrastColorWrapper(_blackColor, false, false), new ContrastColorWrapper(_darkRegion, true, false), new ContrastColorWrapper(_darkBase.BaseColor, true, false) }; _lightColorMappings = ColorMapping.ParseList(rootObject["LightPaletteMapping"].GetArray(), _lightRegion, _darkRegion, _lightBase, _darkBase, _lightPrimary, _darkPrimary, _whiteColor, _blackColor); _lightColorMappings.Sort((a, b) => { return(a.Target.ToString().CompareTo(b.Target.ToString())); }); _darkColorMappings = ColorMapping.ParseList(rootObject["DarkPaletteMapping"].GetArray(), _lightRegion, _darkRegion, _lightBase, _darkBase, _lightPrimary, _darkPrimary, _whiteColor, _blackColor); _darkColorMappings.Sort((a, b) => { return(a.Target.ToString().CompareTo(b.Target.ToString())); }); _lightRegion.ActiveColorChanged += PaletteEntry_ActiveColorChanged; _darkRegion.ActiveColorChanged += PaletteEntry_ActiveColorChanged; _lightBase.BaseColor.ActiveColorChanged += PaletteEntry_ActiveColorChanged; _darkBase.BaseColor.ActiveColorChanged += PaletteEntry_ActiveColorChanged; _lightPrimary.BaseColor.ActiveColorChanged += PaletteEntry_ActiveColorChanged; _darkPrimary.BaseColor.ActiveColorChanged += PaletteEntry_ActiveColorChanged; foreach (var entry in _lightBase.Palette) { entry.ActiveColorChanged += PaletteEntry_ActiveColorChanged; } foreach (var entry in _darkBase.Palette) { entry.ActiveColorChanged += PaletteEntry_ActiveColorChanged; } foreach (var entry in _lightPrimary.Palette) { entry.ActiveColorChanged += PaletteEntry_ActiveColorChanged; } foreach (var entry in _darkPrimary.Palette) { entry.ActiveColorChanged += PaletteEntry_ActiveColorChanged; } if (_lightRegion.Description == null) { _lightRegion.Description = GenerateMappingDescription(_lightRegion, _lightColorMappings); } if (_darkRegion.Description == null) { _darkRegion.Description = GenerateMappingDescription(_darkRegion, _darkColorMappings); } foreach (var entry in _lightBase.Palette) { if (entry.Description == null) { entry.Description = GenerateMappingDescription(entry, _lightColorMappings); } } foreach (var entry in _darkBase.Palette) { if (entry.Description == null) { entry.Description = GenerateMappingDescription(entry, _darkColorMappings); } } foreach (var entry in _lightPrimary.Palette) { if (entry.Description == null) { entry.Description = GenerateMappingDescription(entry, _lightColorMappings); } } foreach (var entry in _darkPrimary.Palette) { if (entry.Description == null) { entry.Description = GenerateMappingDescription(entry, _darkColorMappings); } } }
public bool ExportActivitiesGroupToALM(ActivitiesGroup activitiesGroup, Test mappedTest, string uploadPath, ObservableList <ExternalItemFieldBase> testCaseFields, ref string result) { return(ExportToQC.ExportActivitiesGroupToQC(activitiesGroup, mappedTest, uploadPath, testCaseFields, ref result)); }
public void CollectOriginalElementsDataForDeltaCheck(ObservableList <ElementInfo> originalList) { throw new NotImplementedException(); }
/// <summary> /// Initialize and Bind the UCGrid, also defines the Titles and sets the AddRow Handler. /// </summary> /// <param name="dataSource">The List which all the ActInputValue are saved</param> /// <param name="gridTitle">Sets the Grid Title</param> /// <param name="paramTitle">Sets the Parameter Title</param> /// <param name="valueTitle">Sets the Value Title</param> /// <param name="valueForDriverTitle">Sets the ValueForDriver(Calculated Value) Title</param> public void Init(Context context, ObservableList <ActInputValue> dataSource, string gridTitle = "Input Values", string paramTitle = "Parameter Name", string valueTitle = "Parameter Value", string valueForDriverTitle = "Calculated Parameter Value") { mContext = context; DataSource = dataSource; SetVEGrid(gridTitle, paramTitle, valueTitle, valueForDriverTitle); }
//---------------------------------------------------------------------- public ListView(Screen _screen) : base(_screen) { Columns = new List <ListViewColumn>(); Rows = new ObservableList <ListViewRow>(); Rows.ListCleared += delegate { SelectedRow = null; HoveredRow = null; FocusedRow = null; mHoveredActionButton = null; mbIsHoveredActionButtonDown = false; }; Rows.ListChanged += delegate(object _source, ObservableList <ListViewRow> .ListChangedEventArgs _args) { if (!_args.Added) { if (_args.Item == SelectedRow) { SelectedRow = null; } if (_args.Item == HoveredRow) { UpdateHoveredRow(); } if (_args.Item == FocusedRow) { FocusedRow = null; IsDragging = false; } } }; SelectedRow = null; FocusedRow = null; HoveredRow = null; TextColor = Screen.Style.DefaultTextColor; Padding = Screen.Style.ListViewPadding; Style = Screen.Style.ListViewStyle; Scrollbar = new Scrollbar(_screen); Scrollbar.Parent = this; ActionButtons = new ObservableList <Button>(); ActionButtons.ListCleared += delegate { mHoveredActionButton = null; }; ActionButtons.ListChanged += delegate { if (mHoveredActionButton != null && !ActionButtons.Contains(mHoveredActionButton)) { mHoveredActionButton = null; } }; UpdateContentSize(); }
public override void PrepareDuringExecAction(ObservableList <IGingerRunner> Gingers) { throw new NotImplementedException(); }
public void APIParsingSavingAndPulling() { // Arrange //Act ApplicationAPIModel AAMS1 = new ApplicationAPIModel(); AAMS1.Name = "Soap1"; AAMS1.Description = "Description"; AAMS1.EndpointURL = "EndpointURL"; AAMS1.ReqHttpVersion = ApplicationAPIUtils.eHttpVersion.HTTPV10; AppModelParameter AMDP = new AppModelParameter() { PlaceHolder = "placeholder", Description = "Description" }; OptionalValue OV1 = new OptionalValue("Value1"); OptionalValue OV2 = new OptionalValue("Value2"); AMDP.OptionalValuesList.Add(OV1); AMDP.OptionalValuesList.Add(OV2); AAMS1.AppModelParameters = new ObservableList <AppModelParameter>(); AAMS1.AppModelParameters.Add(AMDP); APIModelKeyValue AMKV = new APIModelKeyValue("param", "value"); //AAMS1.APIModelKeyValueHeaders = new ObservableList<APIModelKeyValue>(); //AAMS1.APIModelKeyValueHeaders.Add(AMKV); AAMS1.NetworkCredentials = ApplicationAPIUtils.eNetworkCredentials.Custom; AAMS1.URLUser = "******"; AAMS1.URLDomain = "URLDomain"; AAMS1.URLPass = "******"; AAMS1.DoNotFailActionOnBadRespose = true; AAMS1.HttpHeaders = new ObservableList <APIModelKeyValue>(); AAMS1.HttpHeaders.Add(AMKV); AAMS1.RequestBodyType = ApplicationAPIUtils.eRequestBodyType.FreeText; AAMS1.CertificateType = ApplicationAPIUtils.eCretificateType.AllSSL; AAMS1.CertificatePath = "CertificatePath"; AAMS1.ImportCetificateFile = true; AAMS1.CertificatePassword = "******"; AAMS1.SecurityType = ApplicationAPIUtils.eSercurityType.Ssl3; AAMS1.AuthorizationType = ApplicationAPIUtils.eAuthType.BasicAuthentication; AAMS1.TemplateFileNameFileBrowser = "TemplateFileNameFileBrowser"; AAMS1.ImportRequestFile = "ImportRequestFile"; AAMS1.AuthUsername = "******"; AAMS1.AuthPassword = "******"; //APIParameter APIP = new APIParameter("parameterName", "parameterType", 1, 2); //AAMS1.ParametersList = new ObservableList<APIParameter>(); //AAMS1.ParametersList.Add(APIP); AAMS1.SOAPAction = "SOAPAction"; SR.AddRepositoryItem(AAMS1); //SR.ClearRepositoryItemsCache<ApplicationAPIModel>(); //TODO: we need to make sure this test run as stand alone or it will mess other UT ObservableList <ApplicationAPIModel> AAMBList = SR.GetAllRepositoryItems <ApplicationAPIModel>(); ApplicationAPIModel AAMS2 = (ApplicationAPIModel)(from x in AAMBList where x.Guid == AAMS1.Guid select x).FirstOrDefault(); // TODO: change 'Value Check' to the name of the field //Assert Assert.AreEqual(AAMS2.Name, "Soap1", "Value Check"); Assert.AreEqual(AAMS2.Description, "Description", "Value Check"); Assert.AreEqual(AAMS2.EndpointURL, "EndpointURL", "Value Check"); Assert.AreEqual(AAMS2.ReqHttpVersion, ApplicationAPIUtils.eHttpVersion.HTTPV10, "Value Check"); Assert.AreEqual(AAMS2.AppModelParameters.Count, 1, "Value Check"); Assert.AreEqual(AAMS2.AppModelParameters[0].OptionalValuesList.Count, 2, "Value Check"); //Assert.AreEqual(AAMS2.APIModelKeyValueHeaders.Count, 1, "Value Check"); Assert.AreEqual(AAMS2.NetworkCredentials, ApplicationAPIUtils.eNetworkCredentials.Custom, "Value Check"); Assert.AreEqual(AAMS2.URLUser, "URLUser", "Value Check"); Assert.AreEqual(AAMS2.URLDomain, "URLDomain", "Value Check"); Assert.AreEqual(AAMS2.URLPass, "URLPass", "Value Check"); Assert.AreEqual(AAMS2.DoNotFailActionOnBadRespose, true, "Value Check"); Assert.AreEqual(AAMS2.HttpHeaders.Count, 1, "Value Check"); Assert.AreEqual(AAMS2.RequestBodyType, ApplicationAPIUtils.eRequestBodyType.FreeText, "Value Check"); Assert.AreEqual(AAMS2.CertificateType, ApplicationAPIUtils.eCretificateType.AllSSL, "Value Check"); Assert.AreEqual(AAMS2.CertificatePath, "CertificatePath", "Value Check"); Assert.AreEqual(AAMS2.ImportCetificateFile, true, "Value Check"); Assert.AreEqual(AAMS2.CertificatePassword, "CertificatePassword", "Value Check"); Assert.AreEqual(AAMS2.SecurityType, ApplicationAPIUtils.eSercurityType.Ssl3, "Value Check"); Assert.AreEqual(AAMS2.AuthorizationType, ApplicationAPIUtils.eAuthType.BasicAuthentication, "Value Check"); Assert.AreEqual(AAMS2.TemplateFileNameFileBrowser, "TemplateFileNameFileBrowser", "Value Check"); Assert.AreEqual(AAMS2.ImportRequestFile, "ImportRequestFile", "Value Check"); Assert.AreEqual(AAMS2.AuthUsername, "AuthUsername", "Value Check"); Assert.AreEqual(AAMS2.AuthPassword, "AuthPassword", "Value Check"); //Assert.AreEqual(AAMS2.ParametersList.Count, 1, "Value Check"); Assert.AreEqual(AAMS2.SOAPAction, "SOAPAction", "Value Check"); }
public override IOperation InstrumentedApply() { IOperator successor = null; if (ActualProbabilitiesParameter.ActualValue == null) { ActualProbabilitiesParameter.Value = ProbabilitiesParameter.ActualValue.Clone() as DoubleArray; } else { String key = "SuccessfulOffspringAnalyzer Results"; ResultCollection results = null; IScope scope = ExecutionContext.Parent.Scope; int depth = 1; while (scope != null && depth < DepthParameter.Value.Value) { scope = scope.Parent; depth++; } if (scope != null) { results = scope.Variables["Results"].Value as ResultCollection; } if (results != null && results.ContainsKey(key)) { ResultCollection successProgressAnalysisResult = results[key].Value as ResultCollection; key = SuccessProgressAnalyisis.Value.Value; if (successProgressAnalysisResult.ContainsKey(key)) { DataTable successProgressAnalysis = successProgressAnalysisResult[key].Value as DataTable; for (int i = 0; i < Operators.Count; i++) { IOperator current = Operators[i]; if (successProgressAnalysis.Rows.ContainsKey(current.Name)) { DataRow row = successProgressAnalysis.Rows[current.Name]; double sum = 0.0; ObservableList <double> usages = row.Values; sum += (double)usages.Last(); ActualProbabilitiesParameter.ActualValue[i] += (sum / ActualProbabilitiesParameter.ActualValue[i]) * Factor.Value.Value; } } } } //normalize double max = ActualProbabilitiesParameter.ActualValue.Max(); for (int i = 0; i < ActualProbabilitiesParameter.ActualValue.Length; i++) { ActualProbabilitiesParameter.ActualValue[i] /= max; ActualProbabilitiesParameter.ActualValue[i] = Math.Max(LowerBoundParameter.Value.Value, ActualProbabilitiesParameter.ActualValue[i]); } } //////////////// code has to be duplicated since ActualProbabilitiesParameter.ActualValue are updated and used for operator selection IRandom random = RandomParameter.ActualValue; DoubleArray probabilities = ActualProbabilitiesParameter.ActualValue; if (probabilities.Length != Operators.Count) { throw new InvalidOperationException(Name + ": The list of probabilities has to match the number of operators"); } var checkedOperators = Operators.CheckedItems; if (checkedOperators.Count() > 0) { // select a random operator from the checked operators successor = checkedOperators.SampleProportional(random, 1, checkedOperators.Select(x => probabilities[x.Index]), false, false).First().Value; } IOperation successorOp = null; if (Successor != null) { successorOp = ExecutionContext.CreateOperation(Successor); } OperationCollection next = new OperationCollection(successorOp); if (successor != null) { SelectedOperatorParameter.ActualValue = new StringValue(successor.Name); if (CreateChildOperation) { next.Insert(0, ExecutionContext.CreateChildOperation(successor)); } else { next.Insert(0, ExecutionContext.CreateOperation(successor)); } } else { SelectedOperatorParameter.ActualValue = new StringValue(""); } return(next); }
List <ElementInfo> IWindowExplorer.GetVisibleControls(List <eElementType> filteredElementType, ObservableList <ElementInfo> foundElementsList = null, bool learnFullElementInfoDetails = false) { return(mUIAutomationHelper.GetVisibleControls()); }
public ElementInfo GetMatchingElement(ElementInfo latestElement, ObservableList <ElementInfo> originalElements) { throw new NotImplementedException(); }
public void InitRunner(GingerRunner runner) { //Configure Runner for execution runner.Status = eRunStatus.Pending; ConfigureRunnerForExecution(runner); //Set the Apps agents foreach (ApplicationAgent appagent in runner.ApplicationAgents) { if (appagent.AgentName != null) { ObservableList <Agent> agents = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>(); appagent.Agent = (from a in agents where a.Name == appagent.AgentName select a).FirstOrDefault(); } } //Load the biz flows runner.BusinessFlows.Clear(); foreach (BusinessFlowRun businessFlowRun in runner.BusinessFlowsRunList) { ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow businessFlow = (from x in businessFlows where x.Guid == businessFlowRun.BusinessFlowGuid select x).FirstOrDefault(); //Fail over to try and find by name if (businessFlow == null) { businessFlow = (from x in businessFlows where x.Name == businessFlowRun.BusinessFlowName select x).FirstOrDefault(); } if (businessFlow == null) { Reporter.ToLog(eLogLevel.ERROR, string.Format("Can not find the '{0}' {1} for the '{2}' {3}", businessFlowRun.BusinessFlowName, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), mRunSetConfig.Name, GingerDicser.GetTermResValue(eTermResKey.RunSet))); continue; } else { // Very slow BusinessFlow BFCopy = (BusinessFlow)businessFlow.CreateCopy(false); BFCopy.Reset(); BFCopy.Active = businessFlowRun.BusinessFlowIsActive; BFCopy.Mandatory = businessFlowRun.BusinessFlowIsMandatory; BFCopy.AttachActivitiesGroupsAndActivities(); if (businessFlowRun.BusinessFlowInstanceGuid == Guid.Empty) { BFCopy.InstanceGuid = Guid.NewGuid(); } else { BFCopy.InstanceGuid = businessFlowRun.BusinessFlowInstanceGuid; } if (businessFlowRun.BusinessFlowCustomizedRunVariables != null && businessFlowRun.BusinessFlowCustomizedRunVariables.Count > 0) { foreach (VariableBase varb in BFCopy.GetBFandActivitiesVariabeles(true)) { VariableBase runVar = businessFlowRun.BusinessFlowCustomizedRunVariables.Where(v => v.ParentGuid == varb.ParentGuid && v.ParentName == varb.ParentName && v.Name == varb.Name).FirstOrDefault(); if (runVar != null) { RepositoryItemBase.ObjectsDeepCopy(runVar, varb); varb.DiffrentFromOrigin = runVar.DiffrentFromOrigin; varb.MappedOutputVariable = runVar.MappedOutputVariable; } else { varb.DiffrentFromOrigin = false; varb.MappedOutputVariable = null; } } } BFCopy.RunDescription = businessFlowRun.BusinessFlowRunDescription; BFCopy.BFFlowControls = businessFlowRun.BFFlowControls; runner.BusinessFlows.Add(BFCopy); } } }
public ObservableList <RallyTestPlan> GetRallyTestPlansByProject(string RallyServerUrl, string RallyUserName, string RallyPassword, string RallyProject, string solutionFolder, string projName) { ObservableList <RallyTestPlan> rallyTestPlanList = new ObservableList <RallyTestPlan>(); RallyRestApi restApi = new RallyRestApi(); restApi.Authenticate(RallyUserName, RallyPassword, RallyServerUrl, proxy: null, allowSSO: false); if (restApi.AuthenticationState == RallyRestApi.AuthenticationResult.Authenticated) { DynamicJsonObject sub = restApi.GetSubscription("Workspaces"); Request wRequest = new Request(sub["Workspaces"]); wRequest.Limit = 1000; int projectId = 0; QueryResult queryWSResult = restApi.Query(wRequest); foreach (var result in queryWSResult.Results) { Request projectsRequest = new Request(result["Projects"]); projectsRequest.Fetch = new List <string>() { "Name", "ObjectID" }; projectsRequest.Limit = 10000; QueryResult queryProjectResult = restApi.Query(projectsRequest); foreach (var p in queryProjectResult.Results) { if (Convert.ToString(p["Name"]) == projName) { int.TryParse(Convert.ToString(p["ObjectID"]), out projectId); break; } } } if (projectId > 0) { //Query for items Request request = new Request("testset"); var projectRef = "/project/" + projectId; request.Query = new Query("Project", Query.Operator.Equals, projectRef); QueryResult queryTestSetResult = restApi.Query(request); foreach (var result in queryTestSetResult.Results) { RallyTestPlan plan = new RallyTestPlan(); int testSetId = 0; int.TryParse(Convert.ToString(result["ObjectID"]), out testSetId); if (testSetId > 0) { plan.Name = Convert.ToString(result["Name"]); plan.RallyID = Convert.ToString(result["ObjectID"]); plan.Description = Convert.ToString(result["Description"]); plan.CreatedBy = Convert.ToString(result["Owner"]["_refObjectName"]); plan.CreationDate = Convert.ToDateTime(result["CreationDate"]); plan.TestCases = new ObservableList <RallyTestCase>(); } rallyTestPlanList.Add(plan); } } } return(rallyTestPlanList); }
public void InitDriverConfigs() { if (DriverConfiguration == null) { DriverConfiguration = new ObservableList <DriverConfigParam>(); } else { DriverConfiguration.Clear(); } //TODO: fix me to be OO style remove the ugly switch switch (DriverType) { case Agent.eDriverType.InternalBrowser: SetDriverDefualtParams(typeof(InternalBrowser)); break; case Agent.eDriverType.SeleniumFireFox: SetDriverDefualtParams(typeof(SeleniumDriver)); break; case Agent.eDriverType.SeleniumChrome: SetDriverDefualtParams(typeof(SeleniumDriver)); break; case Agent.eDriverType.SeleniumIE: SetDriverDefualtParams(typeof(SeleniumDriver)); break; case Agent.eDriverType.SeleniumRemoteWebDriver: SetDriverDefualtParams(typeof(SeleniumDriver)); break; case Agent.eDriverType.SeleniumEdge: SetDriverDefualtParams(typeof(SeleniumDriver)); break; case Agent.eDriverType.SeleniumPhantomJS: SetDriverDefualtParams(typeof(SeleniumDriver)); break; case Agent.eDriverType.ASCF: SetDriverDefualtParams(typeof(ASCFDriver)); break; case Agent.eDriverType.DOSConsole: SetDriverDefualtParams(typeof(DOSConsoleDriver)); break; case Agent.eDriverType.UnixShell: SetDriverDefualtParams(typeof(UnixShellDriver)); break; case Agent.eDriverType.MobileAppiumAndroid: SetDriverDefualtParams(typeof(SeleniumAppiumDriver)); break; case Agent.eDriverType.MobileAppiumIOS: SetDriverDefualtParams(typeof(SeleniumAppiumDriver)); break; case Agent.eDriverType.MobileAppiumAndroidBrowser: case Agent.eDriverType.MobileAppiumIOSBrowser: SetDriverDefualtParams(typeof(SeleniumAppiumDriver)); break; case Agent.eDriverType.PowerBuilder: SetDriverDefualtParams(typeof(PBDriver)); break; case Agent.eDriverType.WindowsAutomation: SetDriverDefualtParams(typeof(WindowsDriver)); break; case Agent.eDriverType.WebServices: SetDriverDefualtParams(typeof(WebServicesDriver)); break; case Agent.eDriverType.JavaDriver: SetDriverDefualtParams(typeof(JavaDriver)); break; case Agent.eDriverType.MainFrame3270: SetDriverDefualtParams(typeof(MainFrameDriver)); break; case Agent.eDriverType.AndroidADB: SetDriverDefualtParams(typeof(AndroidADBDriver)); break; case Agent.eDriverType.PerfectoMobile: SetDriverDefualtParams(typeof(PerfectoDriver)); break; default: //UnKonwen Type!!! break; } }
public void TestObserver() { var list = ObservableList <int> .From(new[] { 1, 4 }); var changes = new List <IListDidChange <int> >(); var disposable = list.Observe(change => changes.Add(change), true); list[1] = 3; // 1, 3 list[2] = 0; // 1, 3, 0 Assert.Equal(3, list.Length); list.Shift(); // 3, 0 list.Push(1, 2); // 3, 0, 1, 2 list.Splice(1, 2, 3, 4); // 3, 3, 4, 2 Assert.Equal(4, list.Length); Assert.Equal(3, list[0]); Assert.Equal(3, list[1]); Assert.Equal(4, list[2]); Assert.Equal(2, list[3]); list.Splice(6); list.Splice(6, 2); list.Replace(new[] { 6 }); list.Pop(); Assert.Throws <InvalidOperationException>(() => list.Pop()); Assert.Equal(8, changes.Count); Assert.Equal(list, changes[0].Object); Assert.Equal(ChangeType.SPLICE, changes[0].Type); Assert.Equal(0, changes[0].Index); Assert.Equal(2, changes[0].AddedCount); Assert.Equal(0, changes[0].RemovedCount); Assert.Empty(changes[0].Removed); Assert.Equal(2, changes[0].Added.Length); Assert.Equal(1, changes[0].Added[0]); Assert.Equal(4, changes[0].Added[1]); Assert.Equal(list, changes[1].Object); Assert.Equal(ChangeType.UPDATE, changes[1].Type); Assert.Equal(1, changes[1].Index); Assert.Equal(4, changes[1].OldValue); Assert.Equal(3, changes[1].NewValue); Assert.Equal(list, changes[2].Object); Assert.Equal(ChangeType.SPLICE, changes[2].Type); Assert.Equal(2, changes[2].Index); Assert.Equal(1, changes[2].AddedCount); Assert.Equal(0, changes[2].RemovedCount); Assert.Empty(changes[2].Removed); Assert.Single(changes[2].Added); Assert.Equal(0, changes[2].Added[0]); Assert.Equal(list, changes[3].Object); Assert.Equal(ChangeType.SPLICE, changes[3].Type); Assert.Equal(0, changes[3].Index); Assert.Equal(0, changes[3].AddedCount); Assert.Equal(1, changes[3].RemovedCount); Assert.Single(changes[3].Removed); Assert.Empty(changes[3].Added); Assert.Equal(1, changes[3].Removed[0]); Assert.Equal(list, changes[4].Object); Assert.Equal(ChangeType.SPLICE, changes[4].Type); Assert.Equal(2, changes[4].Index); Assert.Equal(2, changes[4].AddedCount); Assert.Equal(0, changes[4].RemovedCount); Assert.Empty(changes[4].Removed); Assert.Equal(2, changes[4].Added.Length); Assert.Equal(1, changes[4].Added[0]); Assert.Equal(2, changes[4].Added[1]); Assert.Equal(list, changes[5].Object); Assert.Equal(ChangeType.SPLICE, changes[5].Type); Assert.Equal(1, changes[5].Index); Assert.Equal(2, changes[5].AddedCount); Assert.Equal(2, changes[5].RemovedCount); Assert.Equal(2, changes[5].Removed.Length); Assert.Equal(2, changes[5].Added.Length); Assert.Equal(0, changes[5].Removed[0]); Assert.Equal(1, changes[5].Removed[1]); Assert.Equal(3, changes[5].Added[0]); Assert.Equal(4, changes[5].Added[1]); Assert.Equal(list, changes[6].Object); Assert.Equal(ChangeType.SPLICE, changes[6].Type); Assert.Equal(0, changes[6].Index); Assert.Equal(1, changes[6].AddedCount); Assert.Equal(4, changes[6].RemovedCount); Assert.Equal(4, changes[6].Removed.Length); Assert.Single(changes[6].Added); Assert.Equal(3, changes[6].Removed[0]); Assert.Equal(3, changes[6].Removed[1]); Assert.Equal(4, changes[6].Removed[2]); Assert.Equal(2, changes[6].Removed[3]); Assert.Equal(6, changes[6].Added[0]); Assert.Equal(list, changes[7].Object); Assert.Equal(ChangeType.SPLICE, changes[7].Type); Assert.Equal(0, changes[7].Index); Assert.Equal(0, changes[7].AddedCount); Assert.Equal(1, changes[7].RemovedCount); Assert.Single(changes[7].Removed); Assert.Empty(changes[7].Added); Assert.Equal(6, changes[7].Removed[0]); }
public Scene() { Things = new ObservableList <SceneObject>(); Lights = new ObservableList <Light>(); }
public void TestSetup() { var list = ObservableList <int> .From(); Assert.Empty(list); list.Add(1); Assert.Single(list); Assert.Equal(1, list[0]); list[1] = 2; Assert.Equal(2, list.Length); Assert.Equal(1, list[0]); Assert.Equal(2, list[1]); var compute = ComputedValue <int> .From(() => { return(-1 + list.Aggregate(1, (acc, curr) => acc + curr)); }); Assert.Equal(3, compute.Value); list[1] = 3; Assert.Equal(2, list.Length); Assert.Equal(1, list[0]); Assert.Equal(3, list[1]); Assert.Equal(4, compute.Value); list.Splice(1, 1, 4, 5); Assert.Equal(3, list.Length); Assert.Equal(1, list[0]); Assert.Equal(4, list[1]); Assert.Equal(5, list[2]); Assert.Equal(10, compute.Value); list.Replace(new[] { 2, 4 }); Assert.Equal(2, list.Length); Assert.Equal(2, list[0]); Assert.Equal(4, list[1]); Assert.Equal(6, compute.Value); list.Splice(1, 1); Assert.Equal(1, list.Length); Assert.Equal(2, list[0]); Assert.Equal(2, compute.Value); list.Splice(0, 0, new[] { 4, 3 }); Assert.Equal(3, list.Length); Assert.Equal(4, list[0]); Assert.Equal(3, list[1]); Assert.Equal(2, list[2]); Assert.Equal(9, compute.Value); list.Clear(); Assert.Empty(list); Assert.Equal(0, compute.Value); list.Length = 4; Assert.Equal(4, list.Length); Assert.Equal(0, compute.Value); list.Replace(new[] { 1, 2, 2, 4 }); Assert.Equal(4, list.Length); Assert.Equal(9, compute.Value); list.Length = 4; Assert.Equal(4, list.Length); Assert.Equal(9, compute.Value); list.Length = 2; Assert.Equal(2, list.Length); Assert.Equal(3, compute.Value); Assert.Equal(1, list[0]); Assert.Equal(2, list[1]); list.Unshift(3); Assert.Equal(3, list.Length); Assert.Equal(6, compute.Value); Assert.Equal(3, list[0]); Assert.Equal(1, list[1]); Assert.Equal(2, list[2]); list[2] = 4; Assert.Equal(3, list.Length); Assert.Equal(8, compute.Value); Assert.Equal(3, list[0]); Assert.Equal(1, list[1]); Assert.Equal(4, list[2]); }
public void BackUpRestore() { //Arrange int ActivitiesToCreate = 5; string BizFlowName = "Biz flow Back/Rest"; string BizFlowDescription = "Desc Back/Rest tester"; BusinessFlow BF = new BusinessFlow() { Name = BizFlowName }; BF.Status = BusinessFlow.eBusinessFlowStatus.Development; BF.Activities = new ObservableList <Activity>(); ObservableList <Activity> OriginalActivitiesObj = BF.Activities; for (int i = 1; i <= ActivitiesToCreate; i++) { Activity a = new Activity() { ActivityName = "Activity " + i, Description = "desc" + i, Status = eRunStatus.Passed }; BF.AddActivity(a); } // Create Activity to check ref Activity a6 = new Activity() { ActivityName = "a6" }; BF.Activities.Add(a6); // Add one action to make sure backup drill down, and restore the ref item not a copy ActGotoURL act1 = new ActGotoURL(); act1.Description = "Goto URL 1"; a6.Acts.Add(act1); //add action with input/output vals act1.InputValues = new ObservableList <ActInputValue>(); string firstInputValName = "Param1"; ActInputValue firstInputVal = new ActInputValue() { Param = firstInputValName }; act1.InputValues.Add(firstInputVal); act1.InputValues.Add(new ActInputValue() { Param = "Param2" }); //add flow control act1.FlowControls = new ObservableList <GingerCore.FlowControlLib.FlowControl>(); act1.FlowControls.Add(new GingerCore.FlowControlLib.FlowControl() { Condition = "A=B", FlowControlAction = GingerCore.FlowControlLib.FlowControl.eFlowControlAction.GoToActivity }); GingerCore.FlowControlLib.FlowControl.eFlowControlAction secondFlowControlAction = GingerCore.FlowControlLib.FlowControl.eFlowControlAction.RerunAction; GingerCore.FlowControlLib.FlowControl secondFlowControl = new GingerCore.FlowControlLib.FlowControl() { Condition = "C>123", FlowControlAction = secondFlowControlAction }; act1.FlowControls.Add(secondFlowControl); act1.FlowControls.Add(new GingerCore.FlowControlLib.FlowControl() { Condition = "D=111", FlowControlAction = GingerCore.FlowControlLib.FlowControl.eFlowControlAction.StopRun }); //BF Variables VariableString v = new VariableString(); v.Name = "Var1"; v.Description = "VDesc 1"; BF.AddVariable(v); VariableSelectionList sl = new VariableSelectionList(); sl.Name = "Var 2"; sl.OptionalValuesList = new ObservableList <OptionalValue>(); sl.OptionalValuesList.Add(new OptionalValue("11")); sl.OptionalValuesList.Add(new OptionalValue("22")); sl.OptionalValuesList.Add(new OptionalValue("33")); BF.AddVariable(sl); // BF.SaveBackup(); BF.SaveBackup(); //Erase/Modify some stuff BF.Name = "zzzz"; BF.Description = BizFlowDescription; BF.Status = BusinessFlow.eBusinessFlowStatus.Retired; BF.Activities[1].Description = "AAAA"; BF.Activities.Remove(BF.Activities[2]); BF.Activities.Remove(BF.Activities[3]); act1.Description = "ZZZZZ"; act1.InputValues[0].Param = "qqq"; act1.InputValues.Remove(act1.InputValues[1]); act1.FlowControls[1].FlowControlAction = GingerCore.FlowControlLib.FlowControl.eFlowControlAction.MessageBox; act1.FlowControls.Add(new GingerCore.FlowControlLib.FlowControl() { Condition = "Val=123" }); act1.FlowControls.Add(new GingerCore.FlowControlLib.FlowControl() { Condition = "Val=555" }); sl.OptionalValuesList[0].Value = "aaaa"; sl.OptionalValuesList.Add(new OptionalValue("44")); sl.OptionalValuesList.Add(new OptionalValue("55")); // BF.RestoreFromBackup(); BF.RestoreFromBackup(); // Assert Assert.AreEqual(BF.Name, BizFlowName, "BF.Name"); Assert.AreEqual(BF.Description, null, "BF.Description"); // check enum restore Assert.AreEqual(BF.Status, BusinessFlow.eBusinessFlowStatus.Development, "BF.Status"); Assert.AreEqual(BF.Activities.Count(), ActivitiesToCreate + 1, "BF.Activities.Count()"); //check original list ref obj Assert.AreEqual(BF.Activities, OriginalActivitiesObj, "BF.Activities REF"); Assert.AreEqual(BF.Activities[0].Description, "desc1", "BF.Activities[0].Description"); Assert.AreEqual(BF.Activities[5].ActivityName, "a6", "BF.Activities[5].ActivityName"); // Check original action ref is back Assert.AreEqual(BF.Activities[5], a6, "BF.Activities[5] REF"); Assert.AreEqual(act1.Description, "Goto URL 1", "act1.Description"); Assert.AreEqual(a6.Acts[0], act1, "a6.Acts[0]"); //check Action input values Assert.AreEqual(act1.InputValues.Count, 2, "act1.InputValues.Count"); Assert.AreEqual(act1.InputValues[0], firstInputVal, "act1.InputValues[0] REF"); Assert.AreEqual(act1.InputValues[0].Param, firstInputValName, "act1.InputValues[0].Param"); //check Action flow control Assert.AreEqual(act1.FlowControls.Count, 3, "act1.FlowControls.Count"); Assert.AreEqual(act1.FlowControls[1], secondFlowControl, "act1.FlowControls[1] REF"); Assert.AreEqual(act1.FlowControls[1].FlowControlAction, secondFlowControlAction, "act1.FlowControls[1].FlowControlAction"); //BF variables Assert.AreEqual(BF.Variables.Count, 2, "BF.Variables.Count"); Assert.AreEqual(BF.Variables[1], sl, "BF.Variables[0] REF"); Assert.AreEqual(((VariableSelectionList)BF.Variables[1]).OptionalValuesList[0].Value, "11", "BF.Variables[0].Value"); }
public WordPair(Word word1, Word word2) { Word1 = word1; Word2 = word2; AlignmentNotes = new ObservableList <string>(); }
void ShapesChanged(ObservableList <OrientedConvexShapeEntry> list) { OnShapeChanged(); }
public override void ExportBfActivitiesGroupsToALM(BusinessFlow businessFlow, ObservableList <ActivitiesGroup> grdActivitiesGroups) { bool askToSaveBF = false; foreach (ActivitiesGroup group in grdActivitiesGroups) { if (ExportActivitiesGroupToALM(group)) { askToSaveBF = true; } } if (askToSaveBF) { if (Reporter.ToUser(eUserMsgKey.AskIfToSaveBFAfterExport, businessFlow.Name) == eUserMsgSelection.Yes) { Reporter.ToStatus(eStatusMsgKey.SaveItem, null, businessFlow.Name, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow)); WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(businessFlow); Reporter.HideStatusMessage(); } } }
public SymbolicExpressionGrammarAllowedChildSymbolsControl() { InitializeComponent(); selectedSymbolicExpressionTreeNodes = new ObservableList <ISymbolicExpressionTreeNode>(); }