mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 07:11:10 +00:00
Removes FluentAssertions library from test projects, due to licensing changes
This commit is contained in:
1 parent
c1100e5398
commit
d46bfae4fc
235 files changed
+4468
-4725
No files matched your search
+16
-17
@@ -1,5 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Infrastructure.Common.Models.Configuration;
|
||||
using Lumina.Infrastructure.Core.Security;
|
||||
using Lumina.Infrastructure.UnitTests.Core.Security.Fixtures;
|
||||
@@ -39,8 +38,9 @@ public class CryptographyServiceTests
|
||||
string result = _sut.Encrypt(plaintext);
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNullOrEmpty();
|
||||
result.Should().NotBe(plaintext);
|
||||
Assert.NotNull(result);
|
||||
Assert.NotEmpty(result);
|
||||
Assert.NotEqual(plaintext, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -54,7 +54,7 @@ public class CryptographyServiceTests
|
||||
string result2 = _sut.Encrypt(plaintext);
|
||||
|
||||
// Assert
|
||||
result1.Should().NotBe(result2);
|
||||
Assert.NotEqual(result1, result2);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -66,9 +66,9 @@ public class CryptographyServiceTests
|
||||
Action act = () => _sut.Encrypt(invalidInput!);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<ArgumentException>()
|
||||
.WithParameterName("plaintext")
|
||||
.WithMessage("Value cannot be null or empty*");
|
||||
ArgumentException exception = Assert.Throws<ArgumentException>(() => _sut.Encrypt(invalidInput!));
|
||||
Assert.Equal("plaintext", exception.ParamName);
|
||||
Assert.StartsWith("Value cannot be null or empty", exception.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -82,7 +82,7 @@ public class CryptographyServiceTests
|
||||
string decrypted = _sut.Decrypt(encrypted);
|
||||
|
||||
// Assert
|
||||
decrypted.Should().Be(originalText);
|
||||
Assert.Equal(originalText, decrypted);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -94,9 +94,9 @@ public class CryptographyServiceTests
|
||||
Action act = () => _sut.Decrypt(invalidInput!);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<ArgumentException>()
|
||||
.WithParameterName("ciphertext")
|
||||
.WithMessage("Value cannot be null or empty*");
|
||||
ArgumentException exception = Assert.Throws<ArgumentException>(() => _sut.Decrypt(invalidInput!));
|
||||
Assert.Equal("ciphertext", exception.ParamName);
|
||||
Assert.StartsWith("Value cannot be null or empty", exception.Message);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -108,7 +108,7 @@ public class CryptographyServiceTests
|
||||
Action act = () => _sut.Decrypt(invalidInput);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<FormatException>();
|
||||
Assert.Throws<FormatException>(() => _sut.Decrypt(invalidInput));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -121,8 +121,8 @@ public class CryptographyServiceTests
|
||||
Action act = () => _sut.Decrypt(shortCiphertext);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<ArgumentException>()
|
||||
.WithMessage("Invalid ciphertext");
|
||||
ArgumentException exception = Assert.Throws<ArgumentException>(() => _sut.Decrypt(shortCiphertext));
|
||||
Assert.Equal("Invalid ciphertext", exception.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -141,7 +141,7 @@ public class CryptographyServiceTests
|
||||
Action act = () => _sut.Decrypt(corrupted);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<CryptographicException>();
|
||||
Assert.Throws<CryptographicException>(() => _sut.Decrypt(corrupted));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -155,7 +155,6 @@ public class CryptographyServiceTests
|
||||
_sut.Dispose();
|
||||
|
||||
// Assert
|
||||
Action act = () => _sut.Decrypt(encrypted);
|
||||
act.Should().Throw<CryptographicException>();
|
||||
Assert.Throws<CryptographicException>(() => _sut.Decrypt(encrypted));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FluentAssertions;
|
||||
using Lumina.Infrastructure.Core.Security;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -33,8 +32,9 @@ public class HashServiceTests
|
||||
string result = _sut.HashString(password);
|
||||
|
||||
// Assert
|
||||
result.Should().NotBeNullOrEmpty();
|
||||
result.Should().NotBe(password);
|
||||
Assert.NotNull(result);
|
||||
Assert.NotEmpty(result);
|
||||
Assert.NotEqual(password, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -48,7 +48,7 @@ public class HashServiceTests
|
||||
string hash2 = _sut.HashString(password);
|
||||
|
||||
// Assert
|
||||
hash1.Should().NotBe(hash2);
|
||||
Assert.NotEqual(hash1, hash2);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -63,10 +63,10 @@ public class HashServiceTests
|
||||
string hash = _sut.HashString(input);
|
||||
|
||||
// Assert
|
||||
hash.Should().NotBeNullOrEmpty();
|
||||
Assert.NotNull(hash);
|
||||
Assert.NotEmpty(hash);
|
||||
// verify it's a valid Base64 string
|
||||
Action decode = () => Convert.FromBase64String(hash);
|
||||
decode.Should().NotThrow();
|
||||
Assert.NotNull(Convert.FromBase64String(hash));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -80,7 +80,7 @@ public class HashServiceTests
|
||||
bool result = _sut.CheckStringAgainstHash(password, hash);
|
||||
|
||||
// Assert
|
||||
result.Should().BeTrue();
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -95,7 +95,7 @@ public class HashServiceTests
|
||||
bool result = _sut.CheckStringAgainstHash(wrongPassword, hash);
|
||||
|
||||
// Assert
|
||||
result.Should().BeFalse();
|
||||
Assert.False(result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -111,7 +111,7 @@ public class HashServiceTests
|
||||
bool result = _sut.CheckStringAgainstHash(password, invalidHash);
|
||||
|
||||
// Assert
|
||||
result.Should().BeFalse();
|
||||
Assert.False(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -125,7 +125,7 @@ public class HashServiceTests
|
||||
Action act = () => _sut.CheckStringAgainstHash(password, invalidHash);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<FormatException>();
|
||||
Assert.Throws<FormatException>(() => _sut.CheckStringAgainstHash(password, invalidHash));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -136,7 +136,7 @@ public class HashServiceTests
|
||||
Action act = () => _sut.HashString(nullPassword!);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
Assert.Throws<ArgumentNullException>(() => _sut.HashString(nullPassword!));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -150,7 +150,7 @@ public class HashServiceTests
|
||||
Action act = () => _sut.CheckStringAgainstHash(nullPassword!, hash);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
Assert.Throws<ArgumentNullException>(() => _sut.CheckStringAgainstHash(nullPassword!, hash));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -160,6 +160,6 @@ public class HashServiceTests
|
||||
Action act = () => _sut.CheckStringAgainstHash("password", null!);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
Assert.Throws<ArgumentNullException>(() => _sut.CheckStringAgainstHash("password", null!));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user