/// ------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------- internal void pattern_SetValue(object val, Type expectedException, CheckType checkType) { string newVal = Convert.ToString(val, CultureInfo.CurrentUICulture); string call = "SetValue(" + newVal + ")"; try { Comment("Before " + call + " Value = " + pattern_Value); _pattern.SetValue(newVal); Comment("After " + call + " Value = " + pattern_Value); // Are we in a "no-clobber" state? If so, bail gracefully // This is why we throw an IncorrectElementConfiguration instead of // default value of checkType if (_noClobber == true) { ThrowMe(CheckType.IncorrectElementConfiguration, "/NOCLOBBER flag is set, cannot update the value of the control, exiting gracefully"); } } catch (Exception actualException) { if (Library.IsCriticalException(actualException)) throw; TestException(expectedException, actualException, call, checkType); return; } TestNoException(expectedException, call, checkType); }
public CustomSecurityCheckAttribute(CheckType type) { CheckList.Add(new CheckItem { Type = type }); }
public NPCChecks(CheckType check, params object[] p) { Type = check; for (int i = 0; i < p.Length; i++) Params.Add(p[i]); }
/// <summary> /// Checks a single IP. /// </summary> /// <param name="ip">IP to check.</param> /// <param name="type">Check type.</param> /// <returns>Returns true if IP could be found in the list and false if it couldn't be found.</returns> public override bool CheckSingleIP(string ip, CheckType type) { if (type == CheckType.Trusted) return IsTrusted(ip, ValidationType.Single); else return IsBlocked(ip, ValidationType.Single); }
public void EnumHelper_Parse_ReturnsCorrectEnum(string value, CheckType checkType) { //act var result = EnumHelper<CheckType>.Parse(value); //assert result.Should().Be(checkType); }
public void ParseCheckType_ReturnsCorrectString(CheckType checkType, string expected) { //act var result = EnumFactory.ParseCheckType(checkType); //assert result.Should().Be(expected); }
public CustomSecurityCheckAttribute(CheckType type, string value) { CheckList.Add(new CheckItem { Type = type, value = value }); }
/// <summary> /// Creates a new <c>DividerCheck</c> that relates to the specified divider. /// </summary> /// <param name="divider">The divider the check relates to (not null).</param> /// <param name="types">The type(s) of check this item corresponds to</param> /// <exception cref="ArgumentNullException">If <paramref name="divider"/> is null</exception> internal DividerCheck(IDivider divider, CheckType types) : base(types) { if (divider==null) throw new ArgumentNullException(); m_Divider = divider; }
/// <summary> /// Creates a new <c>TextCheck</c> that relates to the specified text. /// </summary> /// <param name="label">The text the check relates to (not null).</param> /// <param name="types">The type(s) of check this item corresponds to</param> /// <exception cref="ArgumentNullException">If <paramref name="label"/> is null</exception> internal TextCheck(TextFeature label, CheckType types) : base(types) { if (label==null) throw new ArgumentNullException(); m_Label = label; }
/// <summary> /// Creates a new <c>RingCheck</c> that relates to the specified polygon ring. /// </summary> /// <param name="ring">The polygon ring the check relates to (not null).</param> /// <param name="types">The type(s) of check this item corresponds to</param> /// <exception cref="ArgumentNullException">If <paramref name="ring"/> is null</exception> internal RingCheck(Ring ring, CheckType types) : base(types) { if (ring==null) throw new ArgumentNullException(); m_Ring = ring; }
public FieldNameCheck(string FieldName, CheckType[] Types, string[] ErrMsgs, OutputError Output, object[] Other) { this.FieldName = FieldName; this.Types = Types; this.ErrMsgs = ErrMsgs; this.Params = Other; this.Output = Output; }
/// ------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------- internal SelectionItemPattern getSelectionItemPattern(AutomationElement element, CheckType checkType) { SelectionItemPattern sip = (SelectionItemPattern)element.GetCurrentPattern(SelectionItemPattern.Pattern); if (sip == null) ThrowMe(checkType, "\"" + Library.GetUISpyLook(element) + " does not support SelectionItemPattern"); return sip; }
public static bool IsRepeate(CheckType t,string value) { switch(t){ case CheckType.TagName: return IsTagNameRepeate(value); default: return false; } }
public static string GetDefaultName(string locationToCheck, string prefix, CheckType checkType = CheckType.Directory) { if (!Directory.Exists(locationToCheck)) Directory.CreateDirectory(locationToCheck); IEnumerable<string> enumerable; if (checkType == CheckType.Directory) enumerable = Directory.EnumerateDirectories(locationToCheck); else enumerable = Directory.EnumerateFiles(locationToCheck); int[] projectNums = enumerable .Select( dir => { string name; if (checkType == CheckType.Directory) { DirectoryInfo dirInfo = new DirectoryInfo(dir); name = dirInfo.Name; } else { FileInfo fileInfo = new FileInfo(dir); name = fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length); } string pattern = @"^" + prefix + @"(\d+)$"; if (!Regex.IsMatch(name, pattern)) return 0; string value = Regex.Match(name, pattern).Groups[1].Value; return int.Parse(value); }) .OrderBy(i => i).ToArray(); int num = 1; foreach (int projectNum in projectNums) { if (projectNum == num) { num++; } else { break; } } string newName = prefix + num; return newName; }
private static bool GetByteForCheckType(CheckType checkType, ref byte val, IEnumerable<KeyValuePair<byte, CheckType>> dictionary) { foreach (var temp in dictionary) { if (temp.Value == checkType) { val = temp.Key; return true; } } return false; }
public static string CheckTypeToNotation(CheckType checkType) { switch (checkType) { case CheckType.Check: return "+"; case CheckType.CheckAndMate: return "#"; } return ""; }
private void ProcessStreamFlags() { byte[] streamFlags = _reader.ReadBytes(2); UInt32 crc = _reader.ReadLittleEndianUInt32(); UInt32 calcCrc = Crc32.Compute(streamFlags); if (crc != calcCrc) throw new InvalidDataException("Stream header corrupt"); BlockCheckType = (CheckType)(streamFlags[1] & 0x0F); byte futureUse = (byte)(streamFlags[1] & 0xF0); if (futureUse != 0 || streamFlags[0] != 0) throw new InvalidDataException("Unknown XZ Stream Version"); }
/// <summary> /// check to see if any checks in a subcategory match a given check /// </summary> /// <param name="subcategory"></param> /// <param name="type"></param> /// <param name="value"></param> /// <param name="contains"></param> /// <param name="equality"></param> /// <param name="invert"></param> /// <returns>true if there is a matching check in the category</returns> public static bool checkForCheckMatch(customSubCategory subcategory, CheckType type, string value, bool invert = false, bool contains = true, Check.Equality equality = Check.Equality.Equals) { for (int j = 0; j < subcategory.filters.Count; j++) { Filter f = subcategory.filters[j]; for (int k = 0; k < f.checks.Count; k++) { Check c = f.checks[k]; if (c.type == type && c.value == value && c.invert == invert && c.contains == contains && c.equality == equality) return true; } } return false; }
internal void pattern_Expand(Type expectedException, CheckType checkType) { string call = "Expand()"; try { m_pattern.Expand(); System.Threading.Thread.Sleep(1); } catch (Exception actualException) { TestException(expectedException, actualException, call, checkType); return; } TestNoException(expectedException, call, checkType); }
/// ------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------- internal void patternToggle(Type expectedException, CheckType checkType) { string call = "Toggle()"; try { _pattern.Toggle(); } catch (Exception actualException) { if (Library.IsCriticalException(actualException)) throw; TestException(expectedException, actualException, call, checkType); return; } TestNoException(expectedException, call, checkType); }
public CheckLogs(Employee employee, CheckType CheckType, DateTime temptime) { if (employee == null) throw new CheckLogsException(); if (employee.Logs==null) { employee.Logs = new List<CheckLogs>(); } //Remove Seconds //DateTime CheckTime = temptime.AddSeconds(-temptime.Second); DateTime CheckTime = temptime; this.CheckTime = CheckTime; this.CheckType = CheckType; _employee = employee; var _localtion = GPSHelper.GetInstance().GetLocation(); x = Convert.ToDouble(_localtion.Latitude.ToString()); y = Convert.ToDouble(_localtion.Longitude.ToString()); employee.Logs.Add(this); }
private void FileCheckForm_Shown(object sender, EventArgs e) { // Get default options from the registry. string regstr = GlobalUserSetting.Read("FileCheck"); if (String.IsNullOrEmpty(regstr)) regstr = CheckItem.GetAllCheckLetters(); // Convert to option flags m_Options = CheckItem.GetOptions(regstr); // Set check marks beside all the selected options. foreach (char c in regstr) { CheckType check = CheckItem.GetOption(c); CheckBox cb = null; if (check == CheckType.SmallLine) cb = smallLineCheckBox; else if (check == CheckType.Dangle) cb = danglingCheckBox; else if (check == CheckType.Overlap) cb = overlapCheckBox; else if (check == CheckType.Floating) cb = floatingCheckBox; else if (check == CheckType.Bridge) cb = bridgeCheckBox; else if (check == CheckType.SmallPolygon) cb = smallPolygonCheckBox; else if (check == CheckType.NotEnclosed) cb = notEnclosedCheckBox; else if (check == CheckType.NoLabel) cb = noLabelCheckBox; else if (check == CheckType.NoPolygonForLabel) cb = noPolygonForLabelCheckBox; else if (check == CheckType.NoAttributes) cb = noAttributesCheckBox; else if (check == CheckType.MultiLabel) cb = multiLabelCheckBox; if (cb != null) cb.Checked = true; } }
/// <summary> /// Creates a new <c>FileCheckQuery</c> and executes it. /// </summary> /// <param name="model">The model to check</param> /// <param name="checks">Flag bits indicating the checks of interest</param> /// <param name="onCheckItem">Delegate to call whenever a further item is checked (null if no /// callback is required)</param> internal FileCheckQuery(CadastralMapModel model, CheckType checks, OnCheckItem onCheckItem) { if (model==null) throw new ArgumentNullException(); m_OnCheckItem = onCheckItem; m_Options = checks; m_NumCheck = 0; m_Result = new List<CheckItem>(100); ISpatialIndex index = model.Index; index.QueryWindow(null, SpatialType.Line, CheckLine); index.QueryWindow(null, SpatialType.Text, CheckText); index.QueryWindow(null, SpatialType.Polygon, CheckPolygon); // Do any post-processing. PostCheck(m_Result, true); m_Result.TrimExcess(); }
internal void pattern_Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount, Type expectedException, CheckType checkType) { string call = "Scroll(" + horizontalAmount + ", " + verticalAmount + ")"; try { Comment("Before " + call + " VerticalScrollPercent = " + pattern_getVerticalScrollPercent + ", HorizontalScrollPercent = '" + pattern_getHorizontalScrollPercent + "'"); m_pattern.Scroll(horizontalAmount, verticalAmount); Comment("After " + call + " VerticalScrollPercent = " + pattern_getVerticalScrollPercent + ", HorizontalScrollPercent = '" + pattern_getHorizontalScrollPercent + "'"); } catch (Exception actualException) { if (Library.IsCriticalException(actualException)) throw; TestException(expectedException, actualException, call, checkType); return; } TestNoException(expectedException, call, checkType); }
public CheckLogs(Employee employee, CheckType CheckType, DateTime temptime, double x, double y) { if (employee == null) throw new CheckLogsException(); if (employee.Logs == null) { employee.Logs = new List<CheckLogs>(); } //Remove Seconds //DateTime CheckTime = temptime.AddSeconds(-temptime.Second); DateTime CheckTime = temptime; this.CheckTime = CheckTime; this.CheckType = CheckType; employee.Logs.Add(this); //.Add(this); _employee = employee; this.x = x; this.y = y; }
private void txtMagiaovien_TextChanged(object sender, EventArgs e) { if (txtMagiaovien.Text == "") { lblCheckmaGV.Text = "Mã giáo viên có dạng: GVxxx"; lblCheckmaGV.ForeColor = SystemColors.GrayText; picMGVOk.Hide(); picMGVFalse.Hide(); } else { lblCheckmaGV.Text = ""; picMGVOk.Hide(); picMGVFalse.Hide(); } if (GiaoVienDAO.Instance.CheckGiaoVienExist(CheckType.chuanHoaMa(txtMagiaovien.Text))) { lblCheckmaGV.Text = "Mã giáo viên đã tồn tại"; lblCheckmaGV.ForeColor = Color.Red; picMGVFalse.Show(); picMGVOk.Hide(); //txtMagiaovien.Focus(); } else { if (CheckType.Instance.CheckMaGV(CheckType.chuanHoaMa(txtMagiaovien.Text))) { picMGVOk.Show(); picMGVFalse.Hide(); } else if (txtMagiaovien.Text != "") { lblCheckmaGV.Text = "Sai định dạng mã giáo viên"; lblCheckmaGV.ForeColor = Color.Red; picMGVFalse.Show(); picMGVOk.Hide(); } } }
private void txtMahocsinh_TextChanged(object sender, EventArgs e) { if (txtMahocsinh.Text == "") { lblCheckMHS.Text = "Mã học sinh có dạng: HSxxxxx"; lblCheckMHS.ForeColor = SystemColors.GrayText; picMHSOk.Hide(); picMHSSai.Hide(); } else { lblCheckMHS.Text = ""; picMHSOk.Hide(); picMHSSai.Hide(); } if (HocSinhDAO.Instance.checkExistedStuByMaHS(CheckType.chuanHoaMa(txtMahocsinh.Text))) { lblCheckMHS.Text = "Mã học sinh đã tồn tại"; lblCheckMHS.ForeColor = Color.Red; picMHSSai.Show(); picMHSOk.Hide(); //txtMagiaovien.Focus(); } else { if (CheckType.Instance.CheckMaHS(CheckType.chuanHoaMa(txtMahocsinh.Text))) { picMHSOk.Show(); picMHSSai.Hide(); } else if (txtMahocsinh.Text != "") { lblCheckMHS.Text = "Sai định dạng mã học sinh"; lblCheckMHS.ForeColor = Color.Red; picMHSSai.Show(); picMHSOk.Hide(); } } }
public void UpdateSourceTest_AssertTrue() { var sourceRepo = GetSourceRepo("Source_TestDb"); var typeRepo = GetTypeRepo("Source_TestDb"); var stateRepo = GetStateRepo("Source_TestDb"); var checkType = CheckType.Mock(); var state = State.Mock(); var source = Source.Mock(checkType, state); typeRepo.CreateType(checkType); stateRepo.CreateState(state); sourceRepo.CreateSource(source); var updatedSource = sourceRepo.GetSource(source.Id); updatedSource.SetDisplayName("This is an updated object"); var result = sourceRepo.UpdateSource(updatedSource); Assert.True(result, "UpdateSource() should return true"); }
/// <summary>Initializes a new instance of the <see cref="CheckStyle" /> class.</summary> /// <param name="boundary">The boundary.</param> public CheckStyle(Rectangle boundary) { Theme theme = new Theme(DefaultConstants.DefaultStyle); _color = theme.ColorPalette.Progress; _autoSize = true; _character = '✔'; // _characterFont = styleManager.Theme.ColorPalette.Font; _characterFont = SystemFonts.DefaultFont; _checkType = CheckType.Character; _shapeRounding = DefaultConstants.Rounding.BoxRounding; _shapeType = DefaultConstants.BorderType; _thickness = 2.0F; Bitmap _bitmap = new Bitmap(Image.FromStream(new MemoryStream(Convert.FromBase64String(VisualToggleRenderer.GetBase64CheckImage())))); _image = _bitmap; _bounds = boundary; }
public bool isValid(string text, CheckType check) { int value; switch (check) { case CheckType.Int: return(int.TryParse(text, out value)); case CheckType.Port: int.TryParse(text, out value); return(value > 0 && value <= 65535); case CheckType.IP: IPAddress address; return(IPAddress.TryParse(text, out address)); case CheckType.NotEmpty: default: return(!text.IsEmpty()); } }
public async Task LogSearch( PeopleSearchParameters peopleSearchParameters, IImmutableList <Kid> people, string deviceGuid, CheckType checkType, bool filterLocations ) { try { await _searchLoggingRepository.LogSearch( peopleSearchParameters : peopleSearchParameters, people : people, deviceGuid : deviceGuid, checkType : checkType, filterLocations : filterLocations); } catch (Exception e) { Console.WriteLine(e); } }
public static bool Is(string input, CheckType type) { if (string.IsNullOrEmpty(input)) { return(false); } switch (type) { case CheckType.DateTime: return(CheckDateTime(input)); case CheckType.Email: return(IsEmail(input)); case CheckType.IdentityNumber: return(IsIdentityNumber(input)); case CheckType.Telephone: return(IsTelephone(input)); case CheckType.MobilePhone: return(IsMobilePhone(input)); case CheckType.TraceCode: return(IsTraceCode(input)); } return(true); }
private void btnTimkiem_Click(object sender, EventArgs e) { string inputData = CheckType.chuanHoaMa(txtNhapthongtincantimkiem.Text); if (!radTimtheomalop.Checked && !radTimtheotenlop.Checked) { MessageBox.Show("Bạn quên chọn cách tìm kiếm!", "Thông báo", MessageBoxButtons.OK); } else if (radTimtheomalop.Checked) { if (ClassDAO.Instance.getStatusClassbyMaLop(inputData)) { dGVLop.DataSource = DataProvider.Instance.ExecuteQuery("SELECT MaLop,TenLop,TenKhoiLop,TenGV,TenNamHoc FROM dbo.Lop, dbo.GiaoVien, dbo.NamHoc, dbo.KhoiLop WHERE dbo.Lop.MaKhoiLop=dbo.KhoiLop.MaKhoiLop AND dbo.Lop.GVCN = dbo.GiaoVien.MaGV AND dbo.Lop.NamHoc = NamHoc.MaNamHoc AND MaLop = '" + inputData + "'"); } else { MessageBox.Show("Lớp không tồn tại !", "Thông báo", MessageBoxButtons.OK); loadClass(); Reset.ResetAllControls(navigationPage2); txtNhapthongtincantimkiem.Focus(); } } else if (radTimtheotenlop.Checked) { if (ClassDAO.Instance.getStatusClassbyTenLop(inputData)) { dGVLop.DataSource = DataProvider.Instance.ExecuteQuery("SELECT MaLop,TenLop,TenKhoiLop,TenGV,TenNamHoc FROM dbo.Lop, dbo.GiaoVien, dbo.NamHoc, dbo.KhoiLop WHERE dbo.Lop.MaKhoiLop=dbo.KhoiLop.MaKhoiLop AND dbo.Lop.GVCN = dbo.GiaoVien.MaGV AND dbo.Lop.NamHoc = NamHoc.MaNamHoc AND TenLop =N'" + inputData + "'"); } else { MessageBox.Show("Lớp không tồn tại !", "Thông báo", MessageBoxButtons.OK); loadClass(); Reset.ResetAllControls(navigationPage2); txtNhapthongtincantimkiem.Focus(); } } }
public void Check_Is_Nullable() { CheckType.IsNullable <object>().Should().BeTrue(); CheckType.IsNullable <string>().Should().BeTrue(); CheckType.IsNullable <Exception>().Should().BeTrue(); CheckType.IsNullable <List <int> >().Should().BeTrue(); CheckType.IsNullable <byte[]>().Should().BeTrue(); CheckType.IsNullable <bool>().Should().BeFalse(); CheckType.IsNullable <int>().Should().BeFalse(); CheckType.IsNullable <char>().Should().BeFalse(); CheckType.IsNullable <ulong>().Should().BeFalse(); CheckType.IsNullable <TestEnum>().Should().BeFalse(); CheckType.IsNullable <bool?>().Should().BeTrue(); CheckType.IsNullable <int?>().Should().BeTrue(); CheckType.IsNullable <char?>().Should().BeTrue(); CheckType.IsNullable <ulong?>().Should().BeTrue(); CheckType.IsNullable <TestEnum?>().Should().BeTrue(); CheckType.IsNullable(typeof(object)).Should().BeTrue(); CheckType.IsNullable(typeof(void)).Should().BeFalse(); }
/// <summary> /// Creates a new <c>FileCheckQuery</c> and executes it. /// </summary> /// <param name="model">The model to check</param> /// <param name="checks">Flag bits indicating the checks of interest</param> /// <param name="onCheckItem">Delegate to call whenever a further item is checked (null if no /// callback is required)</param> internal FileCheckQuery(CadastralMapModel model, CheckType checks, OnCheckItem onCheckItem) { if (model == null) { throw new ArgumentNullException(); } m_OnCheckItem = onCheckItem; m_Options = checks; m_NumCheck = 0; m_Result = new List <CheckItem>(100); ISpatialIndex index = model.Index; index.QueryWindow(null, SpatialType.Line, CheckLine); index.QueryWindow(null, SpatialType.Text, CheckText); index.QueryWindow(null, SpatialType.Polygon, CheckPolygon); // Do any post-processing. PostCheck(m_Result, true); m_Result.TrimExcess(); }
/// ------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------- internal void pattern_ScrollIntoView(Type expectedException, CheckType checkType) { string call = "ScrollIntoView()"; try { Comment("Before " + call + ", BoundingRectagle = '" + m_le.Current.BoundingRectangle + "'"); _pattern.ScrollIntoView(); Comment("After " + call + ", BoundingRectagle = '" + m_le.Current.BoundingRectangle + "'"); } catch (Exception actualException) { if (Library.IsCriticalException(actualException)) { throw; } TestException(expectedException, actualException, call, checkType); return; } TestNoException(expectedException, call, checkType); }
public virtual void ReadUnknownAttribute(XmlAttribute attribute) { bool result = false; switch (attribute.Name) { case "ShowCheckBox": if (!bool.TryParse(attribute.Value, out result)) { break; } this.CheckType = result ? CheckType.CheckBox : CheckType.None; break; case "ShowRadioButton": if (!bool.TryParse(attribute.Value, out result)) { break; } this.CheckType = result ? CheckType.RadioButton : CheckType.None; break; } }
/// <summary> /// Finds all the UEBuildPlatformFactory types in this assembly and uses them to register all the available platforms /// </summary> /// <param name="bIncludeNonInstalledPlatforms">Whether to register platforms that are not installed</param> public static void RegisterPlatforms(bool bIncludeNonInstalledPlatforms) { // Initialize the installed platform info using (Timeline.ScopeEvent("Initializing InstalledPlatformInfo")) { InstalledPlatformInfo.Initialize(); } // Find and register all tool chains and build platforms that are present Type[] AllTypes; using (Timeline.ScopeEvent("Querying types")) { AllTypes = Assembly.GetExecutingAssembly().GetTypes(); } // register all build platforms first, since they implement SDK-switching logic that can set environment variables foreach (Type CheckType in AllTypes) { if (CheckType.IsClass && !CheckType.IsAbstract) { if (CheckType.IsSubclassOf(typeof(UEBuildPlatformFactory))) { Log.TraceVerbose(" Registering build platform: {0}", CheckType.ToString()); using (Timeline.ScopeEvent(CheckType.Name)) { UEBuildPlatformFactory TempInst = (UEBuildPlatformFactory)Activator.CreateInstance(CheckType); // We need all platforms to be registered when we run -validateplatform command to check SDK status of each if (bIncludeNonInstalledPlatforms || InstalledPlatformInfo.IsValidPlatform(TempInst.TargetPlatform)) { TempInst.RegisterBuildPlatforms(); } } } } } }
//=====================================================================================================================// //================================================== Private Methods ==================================================// //=====================================================================================================================// #region Private Methods private bool HasBeenRaised(CheckType type) { switch (_triggerType) { case TriggerType.Collision: case TriggerType.Trigger: if (type == CheckType.OnEnter && _onEnterEvents != null && _onEnterEvents.doRaise) { return(_raiseOnce && _hasBeenRaisedOnEnter); } if (type == CheckType.OnStay && _onStayEvents != null && _onStayEvents.doRaise) { return(_raiseOnce && _hasBeenRaisedOnStay); } if (type == CheckType.OnExit && _onExitEvents != null && _onExitEvents.doRaise) { return(_raiseOnce && _hasBeenRaisedOnExit); } break; case TriggerType.EnableDisable: if (type == CheckType.OnEnable && _onEnableEvents != null && _onEnableEvents.doRaise) { return(_raiseOnce && _hasBeenRaisedOnEnable); } if (type == CheckType.OnDisable && _onDisableEvents != null && _onDisableEvents.doRaise) { return(_raiseOnce && _hasBeenRaisedOnDisable); } break; } return(_raiseOnce && _hasBeenRaised); }
/// <summary> /// Runs the file check. /// </summary> /// <returns>True if file check was initiated.</returns> internal bool Run() { // Get the user to specify what needs to be checked. FileCheckForm dial = new FileCheckForm(); if (dial.ShowDialog() != DialogResult.OK) { dial.Dispose(); return(false); } m_Options = dial.Options; dial.Dispose(); // Confirm that at least one type of check has been specified if (m_Options == CheckType.Null) { MessageBox.Show("You must pick something you want to check."); return(false); } // Start the item dialog (modeless). m_Status = new CheckReviewForm(this); m_Status.Show(); // Make the initial check. int nCheck = CheckMap(); // Let the review dialog know. m_Status.OnFinishCheck(nCheck, m_Results.Count); // Paint any markers... will be done by controller in idle time // Paint(false); // The check may have failed if an edit was in progress. return(nCheck >= 0); }
/// <summary> /// the list of objects should just be the room's data in the same order as the create message /// </summary> /// <param name="availableRooms"></param> public void ListRooms(Dictionary <RoomId, List <object> > availableRooms, RoomId currentRoomId) { //we need to procedurally populate the scroll frame with the names of the available rooms from the server foreach (KeyValuePair <RoomId, List <object> > room in availableRooms) { RoomType roomtype = CheckType.TryAssignType <RoomType>(room.Value[2]); if (roomtype == RoomType.GreenScreenRoom) { IGuiFrame roomListing = (IGuiFrame)mRoomListingPrototypeFrame.Clone(); Label roomNameLabel = roomListing.SelectSingleElement <Label>("RoomNameLabel"); roomNameLabel.Text = CheckType.TryAssignType <string>(room.Value[5]); Label privacyLevelLabel = roomListing.SelectSingleElement <Label>("PrivacyLevelLabel"); privacyLevelLabel.Text = CheckType.TryAssignType <PrivacyLevel>(room.Value[4]).ToString(); Label populationLevelLabel = roomListing.SelectSingleElement <Label>("PopulationLabel"); populationLevelLabel.Text = CheckType.TryAssignType <uint>(room.Value[6]).ToString(); RoomId newRoomId = new RoomId(room.Key); Button joinRoomButton = roomListing.SelectSingleElement <Button>("JoinRoomButton"); joinRoomButton.Text = Translation.JOIN_ROOM; joinRoomButton.AddOnPressedAction ( delegate() { mSendSwitchingToRoomTypeNotification(roomtype); RoomAPICommands.SwitchRoom(newRoomId, mCurrentRoomRequestType); mMainWindow.Showing = false; } ); mRoomListScrollFrame.AddChildWidget(roomListing, new HorizontalAutoLayout()); } } }
public static Cell GetCell(int objectToCheck, int cellNumberWithinObject, CheckType checkType, Cell[][] grid) { var row = 0; var column = 0; switch (checkType) { case CheckType.Row: row = objectToCheck; column = cellNumberWithinObject; break; case CheckType.Column: column = objectToCheck; row = cellNumberWithinObject; break; case CheckType.Box: row = 3 * (int)Math.Floor(objectToCheck / 3.0) + (int)Math.Floor(cellNumberWithinObject / 3.0); column = 3 * (objectToCheck % 3) + cellNumberWithinObject % 3; break; } return(grid[row][column]); }
public void GetAllSourcesTest_AssertTrue() { var sourceRepo = GetSourceRepo("Source_TestDb"); var typeRepo = GetTypeRepo("Source_TestDb"); var stateRepo = GetStateRepo("Source_TestDb"); var checkType = CheckType.Mock(); var state = State.Mock(); var sources = new List <Source>(); typeRepo.CreateType(checkType); stateRepo.CreateState(state); for (int i = 0; i < 10; i++) { var temp = Source.Mock(checkType, state); sourceRepo.CreateSource(temp); sources.Add(temp); } var result = sourceRepo.GetAllSources(); Assert.True(sources.Count == result.Count(), "GetAllSources() should have as much objects as var sources"); }
/// <summary> /// Serializes the WaitForFile settings into XML /// </summary> /// <param name="doc"></param> /// <param name="infoEvents"></param> void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents) { XmlElement data = doc.CreateElement("WaitForFilesData"); doc.AppendChild(data); data.SetAttribute("checkType", CheckType.ToString()); data.SetAttribute("existenceType", ExistenceType.ToString()); data.SetAttribute("checkTimeoutInterval", CheckTimeoutInterval.ToString()); data.SetAttribute("checkTimeoutTime", checkTimeoutTime.ToString()); data.SetAttribute("checkInterval", CheckInterval.ToString()); data.SetAttribute("timeoutNextDayIfTimePassed", TimeoutNextDayIfTimePassed.ToString()); XmlElement filesNode = doc.CreateElement("checkFiles"); data.AppendChild(filesNode); foreach (string file in files) { XmlElement fileNode = doc.CreateElement("file"); fileNode.SetAttribute("name", file); filesNode.AppendChild(fileNode); } }
public void Check(CheckType checkType) { this.checkType = checkType; switch (checkType) { case CheckType.User: if (dialog == null || !dialog.Visible) { UpdateCheckForm updateCheckForm = new UpdateCheckForm(null); updateCheckForm.Load += new EventHandler(OnLoad); updateCheckForm.StateSet += new UpdateCheckForm.UpdateCheckFormEventHandler(OnStateSet); updateCheckForm.HelpRequested += new HelpEventHandler(OnHelpRequested); dialog = updateCheckForm; DialogCreated?.Invoke(this, updateCheckForm); StateSet?.Invoke(State.Connecting, Properties.Resources.MessageConnecting); //The Connecting state is set in constructor of the form and event is not fired! updateCheckForm.ShowDialog(parent); } break; default: timer.Start(); break; } }
public void GetEventTest_AssertEqual() { var sourceRepo = GetSourceRepo("Event_ProdTestDb"); var typeRepo = GetTypeRepo("Event_ProdTestDb"); var stateRepo = GetStateRepo("Event_ProdTestDb"); var eventRepo = GetEventRepo("Event_ProdTestDb", "Event_ArchTestDb"); var checkType = CheckType.Mock(); typeRepo.CreateType(checkType); var state = State.Mock(); stateRepo.CreateState(state); var source = Source.Mock(checkType, state); sourceRepo.CreateSource(source); var @event = Event.Mock(checkType, state, source); eventRepo.CreateEvent(@event); var result = eventRepo.GetEvent(@event.Id); Assert.Equal(@event.Id, result.Id); }
public void DeleteEventTest_AssertTrue() { var sourceRepo = GetSourceRepo("Event_ProdTestDb"); var typeRepo = GetTypeRepo("Event_ProdTestDb"); var stateRepo = GetStateRepo("Event_ProdTestDb"); var eventRepo = GetEventRepo("Event_ProdTestDb", "Event_ArchTestDb"); var checkType = CheckType.Mock(); typeRepo.CreateType(checkType); var state = State.Mock(); stateRepo.CreateState(state); var source = Source.Mock(checkType, state); sourceRepo.CreateSource(source); var @event = Event.Mock(checkType, state, source); eventRepo.CreateEvent(@event); var result = eventRepo.DeleteEvent(@event, ""); Assert.True(result, "DeleteEvent() should return true"); }
/// ------------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------------- void TS_VerifyValue(object ExpectedValue, bool ShouldBeEqual, CheckType checkType) { Comment("Current value == " + pattern_Value.ToString(CultureInfo.CurrentCulture)); double CurrentValue = pattern_Value; double dExpectedValue = Convert.ToDouble(ExpectedValue, CultureInfo.CurrentCulture); if (ShouldBeEqual) { // equal if (GenericMath.CompareTo(CurrentValue, dExpectedValue) != 0) { ThrowMe(checkType, "Value() returned " + CurrentValue + " but was expecting " + ExpectedValue); } } else { // not equal if (GenericMath.CompareTo(CurrentValue, dExpectedValue) == 0) { ThrowMe(checkType, "Value() returned " + CurrentValue + " but was expecting " + ExpectedValue); } } m_TestStep++; }
public Discover(CheckType checkType, Subnet targetedSubnet, int port, HostAction actionIfUp, HostAction actionIfDown, Stocker redis, string discoveryName, int maxThreads = 3, int shrunkNetworksCIDRMask = 24) { // Initalize object properties _checkType = checkType; _targetedSubnet = targetedSubnet; _targetedPort = port; _redis = redis; _actionIfUp = actionIfUp; _actionIfDown = actionIfDown; _discoveryName = discoveryName; _cts = new CancellationTokenSource(); // Maximum number of threads _maxThreads = maxThreads; if (shrunkNetworksCIDRMask > _targetedSubnet._maskCIDR) { // Shrinking initial subnets in multiple smaller ones _shrunkNetworksCIDRMask = shrunkNetworksCIDRMask; _shrunkSubnets = _targetedSubnet.Shrink(_shrunkNetworksCIDRMask); } else if (shrunkNetworksCIDRMask == _targetedSubnet._maskCIDR) { _shrunkSubnets.Add(_targetedSubnet); } else { Console.WriteLine("FATAL: You can't shrink the initial network in bigger ones. Exiting."); System.Environment.Exit(7); } /* foreach (Subnet net in _shrunkSubnets) { * // Debug console output * Console.WriteLine("One shrunk network is {0}/{1}. Type : {2}.", net._networkIP, net._maskCIDR, net._type); * } */ }
internal AutomationElement pattern_GetItem(int row, int column, bool expectedException, CheckType checkType) { AutomationElement element = null; string call = "GetItem(" + row + ", " + column + ")"; try { element = m_pattern.GetItem(row, column); } catch (InvalidOperationException e) { if (!expectedException) ThrowMe(checkType, call + " threw an expection unexpectedly : " + e.Message); Comment("Successfully called " + call + " with exception thrown as expected"); return null; } if (expectedException) ThrowMe(checkType, call + " did not throw an expection as expected"); Comment("Successfully called " + call + " without an exception thrown"); return element; }
private bool CheckForLocatedDigits(int checkNumber, CheckType checkType) { var removed = false; var digits = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; for (int i = 0; i < 9; i++) { var checkCell = Utility.GetCell(checkNumber, i, checkType, grid); foreach (var digit in checkCell.MightBe) { digits[(digit - 1)]++; } } for (int digit = 1; digit < 10; digit++) { if (digits[(digit - 1)] == 1) { for (int i = 0; i < 9; i++) { var setCell = Utility.GetCell(checkNumber, i, checkType, grid); if (setCell.MightBe.IndexOf(digit) != -1 && setCell.MightBe.Count > 1) { setCell.MightBe = new List<int> { digit }; removed = true; if (chatty) { Console.WriteLine("In " + checkType.ToString() + " " + (checkNumber + 1) + ", " + digit + " can only go in " + setCell.Row + "," + setCell.Column); } break; } } } } return removed; }
/// <summary> /// Delegate that's called whenever the index finds an item of text. /// </summary> /// <param name="item">The item to process</param> /// <returns>True (always), indicating that the query should continue.</returns> private bool CheckText(ISpatialObject item) { Debug.Assert(item is TextFeature); TextFeature label = (TextFeature)item; // Return if the label is non-topological if (!label.IsTopological) { return(true); } // Check the label & restrict to requested types. CheckType types = TextCheck.CheckLabel(label); types &= m_Options; if (types != CheckType.Null) { TextCheck check = new TextCheck(label, types); m_Result.Add(check); } return(OnCheck()); }
/// ------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------- internal void TS_GetRandomSelectableItem(AutomationElement selectionContainer, out AutomationElement element, bool selectedState, CheckType checkType) { Comment("Calling LibraryGetSelectionItems()"); element = null; AutomationElement element2 = null; ; AutomationElementCollection IsSelected; if (selectionContainer.Current.ControlType == ControlType.Calendar) { IsSelected = selectionContainer.FindAll(TreeScope.Descendants, new PropertyCondition(SelectionItemPattern.IsSelectedProperty, true)); if (IsSelected.Count > 0) { switch (selectedState) { case true: // Find something that is selected { // Return the 1st or last element since you can only remove exterior elements from selection element = IsSelected[(bool)Helpers.RandomValue(true, true) == true ? 0 : IsSelected.Count - 1]; break; } case false: // Find something that is not selected yet { switch ((bool)Helpers.RandomValue(true, true)) { case true: // Looking for something at the beginning of the selection element2 = TreeWalker.RawViewWalker.GetPreviousSibling(IsSelected[0]); // If we are at the start, get something from the tail if (element2 == null) { element2 = TreeWalker.RawViewWalker.GetNextSibling(IsSelected[IsSelected.Count - 1]); } // If for some reason they are all selected, then error out if (element2 == null) ThrowMe(checkType, "Could not get any element that was unselected"); break; case false: // Looking for something at the end of the selection element2 = TreeWalker.RawViewWalker.GetNextSibling(IsSelected[IsSelected.Count - 1]); // If we are at the end, get something from the start if (element2 == null) { element2 = TreeWalker.RawViewWalker.GetPreviousSibling(IsSelected[0]); } // If for some reason they are all selected, then error out if (element2 == null) ThrowMe(checkType, "Could not get any element that was unselected"); break; } element = element2; break; } } } } else { Condition condition = new AndCondition ( new PropertyCondition(AutomationElement.IsSelectionItemPatternAvailableProperty, true), new PropertyCondition(SelectionItemPattern.IsSelectedProperty, selectedState) ); IsSelected = selectionContainer.FindAll(TreeScope.Descendants, condition); if (IsSelected.Count > 0) { // Return any element element = IsSelected[(int)Helpers.RandomValue(0, IsSelected.Count - 1)]; } } if (element == null) ThrowMe(checkType, "Could not find element who's SelectionItemPattern.IsSelected = " + selectedState); Comment("Found AutomationElement(" + Library.GetUISpyLook(element) + ")"); m_TestStep++; }
/// ------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------- internal ArrayList TSC_SelectRandomElements(out ArrayList arraySelect, AutomationElement selectionContainer, int selectAtLeast, int selectNoMoreThan, CheckType checkType) { arraySelect = new ArrayList(); ArrayList aecList = HelperGetContainersSelectableItems(selectionContainer); foreach (AutomationElement ae in aecList) Comment("Selectable item(" + Library.GetUISpyLook(ae) + ") found"); SelectionItemPattern sip; bool firstSelected = false; // Calendars are special, you need to select contiguous elements if (selectionContainer.Current.ControlType == ControlType.Calendar) { // Pick between one and seven days to select int numDaysDesired = (int)Helpers.RandomValue(1, 6); AutomationElement nextSelected = (AutomationElement)aecList[(int)Helpers.RandomValue(1, aecList.Count - 1)]; ((SelectionItemPattern)nextSelected.GetCurrentPattern(SelectionItemPattern.Pattern)).Select(); arraySelect.Add(nextSelected); Comment("Calling Select(" + Library.GetUISpyLook(nextSelected) + " )"); int selectCount = 0; // Select in the positive way while ( (null != (nextSelected = TreeWalker.ContentViewWalker.GetNextSibling(nextSelected))) && (bool)nextSelected.GetCurrentPropertyValue(AutomationElement.IsSelectionItemPatternAvailableProperty) && (++selectCount < numDaysDesired) ) { ((SelectionItemPattern)nextSelected.GetCurrentPattern(SelectionItemPattern.Pattern)).AddToSelection(); Comment("Calling AddToSelection(" + Library.GetUISpyLook(nextSelected) + " )"); arraySelect.Add(nextSelected); } nextSelected = m_le; // If we run out going forward, then decrement while ( (selectCount++ < numDaysDesired) && (null != (nextSelected = TreeWalker.ContentViewWalker.GetPreviousSibling(nextSelected))) ) { ((SelectionItemPattern)nextSelected.GetCurrentPattern(SelectionItemPattern.Pattern)).AddToSelection(); Comment("Calling AddToSelection(" + Library.GetUISpyLook(nextSelected) + " )"); arraySelect.Add(nextSelected); } } else { // Make sure we hav enough to patternSelect if (aecList.Count < selectAtLeast) ThrowMe(checkType, "There are not enough elements to select"); // Make sure we don't patternSelect too many selectNoMoreThan = Math.Min(aecList.Count, selectNoMoreThan); int selectCount = 0; int i = -1; // Select... int tryCount = 0; for (; selectCount < selectNoMoreThan; ) { // Fail safe break out if we just can't patternSelect them items...try 10X's if (tryCount++ > (selectNoMoreThan * 10)) ThrowMe(checkType, "Tried to select " + selectNoMoreThan + " items but could not in " + tryCount + " tries"); // Get a random element i = (int)Helpers.RandomValue(0, aecList.Count); sip = ((AutomationElement)aecList[i]).GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern; // found something that is not selected if (sip.Current.IsSelected == false) { Comment("Selecting " + Library.GetUISpyLook((AutomationElement)aecList[i])); if (firstSelected == false) { sip.Select(); firstSelected = true; } else sip.AddToSelection(); arraySelect.Add(aecList[i]); selectCount++; } } } m_TestStep++; return arraySelect; }
/// ------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------- internal void TS_IsSelectable(AutomationElement element, bool Selectable, CheckType checkType) { SelectionItemPattern sip = (SelectionItemPattern)element.GetCurrentPattern(SelectionItemPattern.Pattern); if (!((sip != null) == Selectable)) ThrowMe(checkType, "Element(" + Library.GetUISpyLook(element) + ") does not support the SelectionItemPattern so cannot be selected"); string does = "does " + (Selectable.Equals(true) ? "" : "not "); Comment("Element(" + Library.GetUISpyLook(element) + ") " + does + "supports the SelectionItemPattern"); m_TestStep++; }
/// ------------------------------------------------------------------- /// <summary></summary> /// ------------------------------------------------------------------- internal void TS_AtLeastSelectableChildCount(AutomationElement element, int expectedCount, CheckType checkType) { ArrayList statements = new ArrayList(); int count = Helpers.GetSelectableItems(element).Count; if (count < expectedCount) ThrowMe(checkType, "Expected " + expectedCount + " items to be selected but childcount is only " + count); Comment("GetChildrenCount returned " + count); m_TestStep++; }
private void TS_LoadMenuDefinition(string xml, ref XmlDocument doc, CheckType checkType) { doc.LoadXml(xml); m_TestStep++; }
public static AccuracyCheck WithCheckType(this AccuracyCheck accuracyCheck, CheckType checkType) { accuracyCheck.CheckType = checkType; return(accuracyCheck); }
internal static ChecklistItem GetCheck(CheckType check) { return(Checklist._checklist.Checks[(int)check]); }
public void LeaveRoomForClient(Message receivedMessage, Guid senderId) { RoomId roomIdToLeave = CheckType.TryAssignType <RoomId>(receivedMessage.Data[0]); LeaveRoom(senderId, roomIdToLeave); }