TheAlgorithms / C-Sharp

All algorithms implemented in C#.
GNU General Public License v3.0
6.93k stars 1.49k forks source link

Fix BlowfishEncoder or BlowfishEncoderTests #427

Closed siriak closed 8 months ago

siriak commented 8 months ago

BlowfishEncoder tests fail from time to time for no apparent reason. See test log below for more details:

Failed BlowfishEncoder_Decryption_ShouldWorkCorrectly [105 ms]
  Error Message:
   Expected result to be 
"123456abcd1325[36](https://github.com/TheAlgorithms/C-Sharp/actions/runs/7259358644/job/19776334635#step:6:37)", but 
"1c0dfbe8468a4240" differs near "c0d" (index 1).
  Stack Trace:
     at FluentAssertions.Execution.LateBoundTestFramework.Throw(String message)
   at FluentAssertions.Execution.TestFrameworkProvider.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Primitives.StringEqualityValidator.ValidateAgainstMismatch()
   at FluentAssertions.Primitives.StringAssertions.Be(String expected, String because, Object[] becauseArgs)
   at Algorithms.Tests.Encoders.BlowfishEncoderTests.BlowfishEncoder_Decryption_ShouldWorkCorrectly() in /home/runner/work/C-Sharp/C-Sharp/Algorithms.Tests/Encoders/BlowfishEncoderTests.cs:line 42

Failed!  - Failed:     1, Passed:  81[39](https://github.com/TheAlgorithms/C-Sharp/actions/runs/7259358644/job/19776334635#step:6:40), Skipped:     0, Total:  81[40](https://github.com/TheAlgorithms/C-Sharp/actions/runs/7259358644/job/19776334635#step:6:41), Duration: 1 m 11 s - Algorithms.Tests.dll (net6.0)
KoditkarVedant commented 8 months ago

@siriak I see what is causing this issue. The tests are running in parallel and causing it to fail as the _encoder is getting re-initialized... I will create a PR.