Skip to content
This repository has been archived by the owner on Apr 30, 2022. It is now read-only.

Commit

Permalink
Adding Assertion to fix SonarLint 2699 (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
FermJacob authored Nov 24, 2020
1 parent 3699942 commit 3112f71
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Framework/BaseTest/SoftAssert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// <summary>This is the SoftAssert class</summary>
//--------------------------------------------------
using Magenic.Maqs.Utilities.Data;
using Magenic.Maqs.Utilities.Helper;
using Magenic.Maqs.Utilities.Logging;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -244,6 +245,7 @@ public virtual void LogFinalAssertData()
/// <summary>
/// Fail test if there were one or more failures
/// </summary>
[AssertionMethod]
public void FailTestIfAssertFailed()
{
this.FailTestIfAssertFailed("*See log for more details");
Expand All @@ -253,6 +255,7 @@ public void FailTestIfAssertFailed()
/// Fail test if there were one or more failures
/// </summary>
/// <param name="message">Customer error message</param>
[AssertionMethod]
public void FailTestIfAssertFailed(string message)
{
this.CheckForExpectedAsserts();
Expand Down
19 changes: 19 additions & 0 deletions Framework/Utilities/Helper/AssertionMethodAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//--------------------------------------------------
// <copyright file="SoftAssert.cs" company="Magenic">
// Copyright 2020 Magenic, All rights Reserved
// </copyright>
// <summary>This is the SoftAssert class</summary>
//--------------------------------------------------
using System;

namespace Magenic.Maqs.Utilities.Helper
{
/// <summary>
/// SonarLink 2699 Tests should include assertions
/// Used for SoftAsserts
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
public class AssertionMethodAttribute : Attribute
{
}
}

0 comments on commit 3112f71

Please sign in to comment.