public void MinAndMaxWithVersions(string strVersionFirst, string strVersionSecond) { Version verFirst = strVersionFirst == null ? null : new Version(strVersionFirst); Version verSecond = strVersionSecond == null ? null : new Version(strVersionSecond); Version verExpectedMax = verFirst == null ? verSecond : verSecond == null ? verFirst : verFirst >= verSecond ? verFirst : verSecond; Version verMax = ComparisonUtility.Max(verFirst, verSecond); Assert.AreEqual(verExpectedMax, verMax); Version verExpectedMin = verFirst == null ? verFirst : verSecond == null ? verSecond : verFirst <= verSecond ? verFirst : verSecond; Version verMin = ComparisonUtility.Min(verFirst, verSecond); Assert.AreEqual(verExpectedMin, verMin); if (verFirst != null && verFirst.Equals(verSecond)) { Assert.AreSame(verFirst, verMax); Assert.AreSame(verFirst, verMin); } }
//============================================================ // ICOMPARABLE IMPLEMENTATION //============================================================ #region CompareTo(object obj) /// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { //------------------------------------------------------------ // If target is a null reference, instance is greater //------------------------------------------------------------ if (obj == null) { return(1); } //------------------------------------------------------------ // Determine comparison result using property state of objects //------------------------------------------------------------ PingbackSyndicationExtension value = obj as PingbackSyndicationExtension; if (value != null) { int result = Uri.Compare(this.Context.Server, value.Context.Server, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase); result = result | Uri.Compare(this.Context.Target, value.Context.Target, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase); result = result | ComparisonUtility.CompareSequence(this.Context.Abouts, value.Context.Abouts, StringComparison.OrdinalIgnoreCase); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
//============================================================ // ICOMPARABLE IMPLEMENTATION //============================================================ #region CompareTo(object obj) /// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { //------------------------------------------------------------ // If target is a null reference, instance is greater //------------------------------------------------------------ if (obj == null) { return(1); } //------------------------------------------------------------ // Determine comparison result using property state of objects //------------------------------------------------------------ FeedSynchronizationItem value = obj as FeedSynchronizationItem; if (value != null) { int result = String.Compare(this.Id, value.Id, StringComparison.OrdinalIgnoreCase); result = result | this.ConflictPreservation.CompareTo(value.ConflictPreservation); result = result | this.TombstoneStatus.CompareTo(value.TombstoneStatus); result = result | this.Updates.CompareTo(value.Updates); result = result | FeedSynchronizationItem.CompareSequence(this.Histories, value.Histories); result = result | ComparisonUtility.CompareSequence(this.Conflicts, value.Conflicts); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
/// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { if (obj == null) { return(1); } OpmlOutline value = obj as OpmlOutline; if (value != null) { int result = String.Compare(this.ContentType, value.ContentType, StringComparison.OrdinalIgnoreCase); result = result | this.CreatedOn.CompareTo(value.CreatedOn); result = result | this.HasBreakpoint.CompareTo(value.HasBreakpoint); result = result | this.IsCommented.CompareTo(value.IsCommented); result = result | String.Compare(this.Text, value.Text, StringComparison.OrdinalIgnoreCase); result = result | ComparisonUtility.CompareSequence(this.Attributes, value.Attributes, StringComparison.OrdinalIgnoreCase); result = result | ComparisonUtility.CompareSequence(this.Categories, value.Categories, StringComparison.OrdinalIgnoreCase); result = result | OpmlOutline.CompareSequence(this.Outlines, value.Outlines); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
//============================================================ // ICOMPARABLE IMPLEMENTATION //============================================================ #region CompareTo(object obj) /// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { //------------------------------------------------------------ // If target is a null reference, instance is greater //------------------------------------------------------------ if (obj == null) { return(1); } //------------------------------------------------------------ // Determine comparison result using property state of objects //------------------------------------------------------------ SiteSummarySlashSyndicationExtension value = obj as SiteSummarySlashSyndicationExtension; if (value != null) { int result = this.Context.Comments.CompareTo(value.Context.Comments); result = result | String.Compare(this.Context.Department, value.Context.Department, StringComparison.OrdinalIgnoreCase); result = result | String.Compare(this.Context.Section, value.Context.Section, StringComparison.OrdinalIgnoreCase); result = result | ComparisonUtility.CompareSequence(this.Context.HitParade, value.Context.HitParade); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
public int CompareTo(object obj) { if (obj == null) { return(1); } var syndicationExtension = obj as TagsSyndicationExtension; if (syndicationExtension != null) { return (string.Compare(Description, syndicationExtension.Description, StringComparison.OrdinalIgnoreCase) | Uri.Compare(Documentation, syndicationExtension.Documentation, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase) | string.Compare(Name, syndicationExtension.Name, StringComparison.OrdinalIgnoreCase) | Version.CompareTo(syndicationExtension.Version) | string.Compare(XmlNamespace, syndicationExtension.XmlNamespace, StringComparison.Ordinal) | string.Compare(XmlPrefix, syndicationExtension.XmlPrefix, StringComparison.Ordinal) | ComparisonUtility.CompareSequence(Context.Tags, syndicationExtension.Context.Tags, StringComparison.OrdinalIgnoreCase)); } throw new ArgumentException( string.Format(null, "obj is not of type {0}, type was found to be '{1}'.", (object)GetType().FullName, (object)obj.GetType().FullName), nameof(obj)); }
//============================================================ // ICOMPARABLE IMPLEMENTATION //============================================================ #region CompareTo(object obj) /// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { //------------------------------------------------------------ // If target is a null reference, instance is greater //------------------------------------------------------------ if (obj == null) { return(1); } //------------------------------------------------------------ // Determine comparison result using property state of objects //------------------------------------------------------------ YahooMediaRestriction value = obj as YahooMediaRestriction; if (value != null) { int result = ComparisonUtility.CompareSequence(this.Entities, value.Entities, StringComparison.Ordinal); result = result | this.EntityType.CompareTo(value.EntityType); result = result | this.Relationship.CompareTo(value.Relationship); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
//============================================================ // ICOMPARABLE IMPLEMENTATION //============================================================ #region CompareTo(object obj) /// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { //------------------------------------------------------------ // If target is a null reference, instance is greater //------------------------------------------------------------ if (obj == null) { return(1); } //------------------------------------------------------------ // Determine comparison result using property state of objects //------------------------------------------------------------ RsdApplicationInterface value = obj as RsdApplicationInterface; if (value != null) { int result = Uri.Compare(this.Documentation, value.Documentation, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase); result = result | this.IsPreferred.CompareTo(value.IsPreferred); result = result | Uri.Compare(this.Link, value.Link, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase); result = result | String.Compare(this.Name, value.Name, StringComparison.OrdinalIgnoreCase); result = result | String.Compare(this.Notes, value.Notes, StringComparison.OrdinalIgnoreCase); result = result | ComparisonUtility.CompareSequence(this.Settings, value.Settings, StringComparison.Ordinal); result = result | String.Compare(this.WeblogId, value.WeblogId, StringComparison.OrdinalIgnoreCase); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
/// <summary> /// Compares the collections for objects that implement the <see cref="IYahooMediaCommonObjectEntities"/> interface. /// </summary> /// <param name="source">A object that implements the <see cref="IYahooMediaCommonObjectEntities"/> interface to be compared.</param> /// <param name="target">A object that implements the <see cref="IYahooMediaCommonObjectEntities"/> to compare with the <paramref name="source"/>.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> private static int CompareCommonObjectEntityCollections(IYahooMediaCommonObjectEntities source, IYahooMediaCommonObjectEntities target) { int result = 0; if (source == null && target == null) { return(0); } else if (source != null && target == null) { return(1); } else if (source == null && target != null) { return(-1); } result = result | YahooMediaUtility.CompareSequence(source.Categories, target.Categories); result = result | YahooMediaUtility.CompareSequence(source.Credits, target.Credits); result = result | YahooMediaUtility.CompareSequence(source.Hashes, target.Hashes); result = result | ComparisonUtility.CompareSequence(source.Keywords, target.Keywords, StringComparison.OrdinalIgnoreCase); result = result | YahooMediaUtility.CompareSequence(source.Ratings, target.Ratings); result = result | YahooMediaUtility.CompareSequence(source.Restrictions, target.Restrictions); result = result | YahooMediaUtility.CompareSequence(source.TextSeries, target.TextSeries); result = result | YahooMediaUtility.CompareSequence(source.Thumbnails, target.Thumbnails); return(result); }
/// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { if (obj == null) { return(1); } ITunesSyndicationExtension value = obj as ITunesSyndicationExtension; if (value != null) { int result = String.Compare(this.Context.Author, value.Context.Author, StringComparison.OrdinalIgnoreCase); result = result | ITunesSyndicationExtension.CompareSequence(this.Context.Categories, value.Context.Categories); result = result | this.Context.Duration.CompareTo(value.Context.Duration); result = result | this.Context.ExplicitMaterial.CompareTo(value.Context.ExplicitMaterial); result = result | Uri.Compare(this.Context.Image, value.Context.Image, UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.OrdinalIgnoreCase); result = result | this.Context.IsBlocked.CompareTo(value.Context.IsBlocked); result = result | ComparisonUtility.CompareSequence(this.Context.Keywords, value.Context.Keywords, StringComparison.OrdinalIgnoreCase); result = result | Uri.Compare(this.Context.NewFeedUrl, value.Context.NewFeedUrl, UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.OrdinalIgnoreCase); result = result | this.Context.Owner.CompareTo(value.Context.Owner); result = result | String.Compare(this.Context.Subtitle, value.Context.Subtitle, StringComparison.OrdinalIgnoreCase); result = result | String.Compare(this.Context.Summary, value.Context.Summary, StringComparison.OrdinalIgnoreCase); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
/// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { if (obj == null) { return(1); } CreativeCommonsSyndicationExtension value = obj as CreativeCommonsSyndicationExtension; if (value != null) { int result = String.Compare(this.Description, value.Description, StringComparison.OrdinalIgnoreCase); result = result | Uri.Compare(this.Documentation, value.Documentation, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase); result = result | String.Compare(this.Name, value.Name, StringComparison.OrdinalIgnoreCase); result = result | this.Version.CompareTo(value.Version); result = result | String.Compare(this.XmlNamespace, value.XmlNamespace, StringComparison.Ordinal); result = result | String.Compare(this.XmlPrefix, value.XmlPrefix, StringComparison.Ordinal); result = result | ComparisonUtility.CompareSequence(this.Context.Licenses, value.Context.Licenses, StringComparison.OrdinalIgnoreCase); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
public void CreateAndDeleteAlertProcessingRule() { using (MockContext context = MockContext.Start(this.GetType())) { var alertsManagementClient = GetAlertsManagementClient(context, handler); string resourceGroupName = "ActionRules-Powershell-Test"; string alertProcessingRuleName = "ScenarioTest-AlertProcessingRule"; // Create Alert Processing Rule AlertProcessingRule alertProcessingRule = new AlertProcessingRule( location: "Global", tags: new Dictionary <string, string>(), properties: new AlertProcessingRuleProperties( scopes: new List <string> { "/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/resourceGroups/alertslab", "/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/resourceGroups/Test-VMs" }, conditions: new List <Condition> { new Condition( field: "Severity", operatorProperty: "Equals", values: new List <string> { "Sev2" }) }, schedule: new Schedule( effectiveFrom: "2019-12-22T11:00:00", effectiveUntil: "2020-09-24T11:00:00", timeZone: "Pacific Standard Time", recurrences: new List <Recurrence> { new DailyRecurrence(startTime: "06:00:00", endTime: "14:00:00") } ), actions: new List <Action> { new RemoveAllActionGroups() }, description: "Test Supression Rule", enabled: true ) ); var createdAlertProcessingRule = alertsManagementClient.AlertProcessingRules.CreateOrUpdate(resourceGroupName: resourceGroupName, alertProcessingRuleName: alertProcessingRuleName, alertProcessingRule: alertProcessingRule); // Get Alert processing rule by name var fetchedAlertProcessingRule = alertsManagementClient.AlertProcessingRules.GetByName(resourceGroupName: resourceGroupName, alertProcessingRuleName: alertProcessingRuleName); if (!this.IsRecording) { ComparisonUtility.AreEqual(createdAlertProcessingRule, fetchedAlertProcessingRule); } // Delete created alert processing rule alertsManagementClient.AlertProcessingRules.Delete(resourceGroupName: resourceGroupName, alertProcessingRuleName: alertProcessingRuleName); } }
internal bool DepthTestPasses(float newDepth, float currentDepth) { if (!_isDepthEnabled) { return(true); } return(ComparisonUtility.DoComparison( _depthComparison, newDepth, currentDepth)); }
public void ChainedCompare(int nLeft, int nRight, int nResult) { var comparer = ComparisonUtility.CreateComparer <int>((x, y) => (x % 10).CompareTo(y % 10), (x, y) => (x / 10).CompareTo(y / 10)); Assert.AreEqual(nResult, NormalizeResult(comparer.Compare(nLeft, nRight))); Assert.AreEqual(nResult, NormalizeResult(ComparisonUtility.ChainedCompare(nLeft, nRight, (x, y) => (x % 10).CompareTo(y % 10), (x, y) => (x / 10).CompareTo(y / 10)))); var comparison = ComparisonUtility.CreateChainedComparison <int>((x, y) => (x % 10).CompareTo(y % 10), (x, y) => (x / 10).CompareTo(y / 10)); Assert.AreEqual(nResult, NormalizeResult(comparison(nLeft, nRight))); }
public void SequenceCompare() { var ascending = new[] { 1, 2, 3, 4, 5, 6 }; var neither = new[] { 1, 6, 5, 2, 3, 4 }; Assert.Less(ascending.SequenceCompare(neither), 0); Assert.Less(0, neither.SequenceCompare(ascending)); Assert.AreEqual(0, ascending.SequenceCompare(neither.OrderBy(x => x))); Assert.AreEqual(0, neither.OrderBy(x => x).SequenceCompare(ascending)); Assert.AreEqual(0, ascending.SequenceCompare(neither, ComparisonUtility.CreateComparer <int>((x, y) => (x % 2).CompareTo(y % 2)))); }
public void IsSorted() { var ascending = new[] { 1, 2, 3, 4, 5, 6 }; var descending = new[] { 6, 5, 4, 3, 2, 1 }; var neither = new[] { 6, 1, 5, 2, 4, 3 }; Assert.IsTrue(ascending.IsSorted()); Assert.IsFalse(descending.IsSorted()); Assert.IsFalse(neither.IsSorted()); var inverse = ComparisonUtility.CreateComparer <int>((x, y) => - x.CompareTo(y)); Assert.IsFalse(ascending.IsSorted(inverse)); Assert.IsTrue(descending.IsSorted(inverse)); Assert.IsFalse(neither.IsSorted(inverse)); }
/// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { if (obj == null) { return(1); } TrackbackSyndicationExtension value = obj as TrackbackSyndicationExtension; if (value != null) { int result = Uri.Compare(this.Context.Ping, value.Context.Ping, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase); result = result | ComparisonUtility.CompareSequence(this.Context.Abouts, value.Context.Abouts, StringComparison.OrdinalIgnoreCase); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
/// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { if (obj == null) { return(1); } YahooMediaRestriction value = obj as YahooMediaRestriction; if (value != null) { int result = ComparisonUtility.CompareSequence(this.Entities, value.Entities, StringComparison.Ordinal); result = result | this.EntityType.CompareTo(value.EntityType); result = result | this.Relationship.CompareTo(value.Relationship); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
/// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception> public int CompareTo(object obj) { if (obj == null) { return(1); } SiteSummarySlashSyndicationExtension value = obj as SiteSummarySlashSyndicationExtension; if (value != null) { int result = this.Context.Comments.CompareTo(value.Context.Comments); result = result | String.Compare(this.Context.Department, value.Context.Department, StringComparison.OrdinalIgnoreCase); result = result | String.Compare(this.Context.Section, value.Context.Section, StringComparison.OrdinalIgnoreCase); result = result | ComparisonUtility.CompareSequence(this.Context.HitParade, value.Context.HitParade); return(result); } else { throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj"); } }
private void CheckAllAlertsContainsUpdatedAlertObject(IPage <Alert> allAlerts, Alert alertPostStateChange) { bool alertFound = false; var enumerator = allAlerts.GetEnumerator(); while (enumerator.MoveNext()) { Alert current = enumerator.Current; if (current.Properties.Essentials.SourceCreatedId == alertPostStateChange.Properties.Essentials.SourceCreatedId) { alertFound = true; ComparisonUtility.AreEqual(alertPostStateChange, current); break; } } if (!alertFound) { throw new Exception("Test Failed : Alert not found in list of alerts."); } }
public void CreateComparer(int nLeft, int nRight, int nResult) { var comparer = ComparisonUtility.CreateComparer <int>((x, y) => - x.CompareTo(y)); Assert.AreEqual(nResult, NormalizeResult(comparer.Compare(nLeft, nRight))); }
private int DataTransferRowComparison(DataTransferRow x, DataTransferRow y) { return(ComparisonUtility.Default(x, y, TypeSelector, ValueSelector)); }
public void CreateAndDeleteActionRule() { using (MockContext context = MockContext.Start(this.GetType().FullName)) { var alertsManagementClient = GetAlertsManagementClient(context, handler); string resourceGroupName = "ActionRules-Powershell-Test"; string actionRuleName = "ScenarioTest-ActionRule"; // Create Action Rule ActionRule actionRule = new ActionRule( location: "Global", tags: new Dictionary <string, string>(), properties: new Suppression( scope: new Scope( scopeType: ScopeType.ResourceGroup, values: new List <string> { "/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/resourceGroups/alertslab", "/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/resourceGroups/Test-VMs" } ), conditions: new Conditions( severity: new Condition( operatorProperty: "Equals", values: new List <string> { "Sev2" }) ), suppressionConfig: new SuppressionConfig( recurrenceType: "Once", schedule: new SuppressionSchedule( startDate: "12/09/2018", endDate: "12/18/2018", startTime: "06:00:00", endTime: "14:00:00" ) ), description: "Test Supression Rule", status: "Enabled" ) ); var createdActionRule = alertsManagementClient.ActionRules.CreateUpdate(resourceGroupName: resourceGroupName, actionRuleName: actionRuleName, actionRule: actionRule); // Get Action rule by name var fetchedActionRule = alertsManagementClient.ActionRules.GetByName(resourceGroupName: resourceGroupName, actionRuleName: actionRuleName); if (!this.IsRecording) { ComparisonUtility.AreEqual(createdActionRule, fetchedActionRule); } // Delete created action rule bool?deleted = alertsManagementClient.ActionRules.Delete(resourceGroupName: resourceGroupName, actionRuleName: actionRuleName); if (!this.IsRecording) { Assert.True(deleted); } } }
public void MinAndMaxWithInt32s(int nFirst, int nSecond) { Assert.AreEqual(Math.Min(nFirst, nSecond), ComparisonUtility.Min(nFirst, nSecond)); Assert.AreEqual(Math.Max(nFirst, nSecond), ComparisonUtility.Max(nFirst, nSecond)); }
public void NoComparers() { Assert.Throws <ArgumentException>(() => ComparisonUtility.CreateComparer <int>()); }