diff options
author | crupest <crupest@outlook.com> | 2020-10-31 00:42:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-31 00:42:06 +0800 |
commit | a3c97f6fb6313da2e8c0fac0b4c08f2ef4265d0f (patch) | |
tree | ee006874b0c93e9bfc76f141a092a8b9585a1f95 /Timeline.Tests/UsernameValidatorUnitTest.cs | |
parent | 0c4caaebe2480e77918d5d7df234f0edaeab74ba (diff) | |
parent | 7ce0846d9ec968da3ea4f7ebcc6db26db8e49089 (diff) | |
download | timeline-a3c97f6fb6313da2e8c0fac0b4c08f2ef4265d0f.tar.gz timeline-a3c97f6fb6313da2e8c0fac0b4c08f2ef4265d0f.tar.bz2 timeline-a3c97f6fb6313da2e8c0fac0b4c08f2ef4265d0f.zip |
Merge pull request #161 from crupest/upgrade
Upgrade packages and split front end and back end.
Diffstat (limited to 'Timeline.Tests/UsernameValidatorUnitTest.cs')
-rw-r--r-- | Timeline.Tests/UsernameValidatorUnitTest.cs | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/Timeline.Tests/UsernameValidatorUnitTest.cs b/Timeline.Tests/UsernameValidatorUnitTest.cs deleted file mode 100644 index 5b568adf..00000000 --- a/Timeline.Tests/UsernameValidatorUnitTest.cs +++ /dev/null @@ -1,78 +0,0 @@ -using FluentAssertions;
-using Timeline.Models.Validation;
-using Timeline.Tests.Helpers;
-using Xunit;
-
-namespace Timeline.Tests
-{
- public class UsernameValidatorUnitTest : IClassFixture<UsernameValidator>
- {
- private readonly UsernameValidator _validator;
-
- public UsernameValidatorUnitTest(UsernameValidator validator)
- {
- _validator = validator;
- }
-
- private string FailAndMessage(string username)
- {
- var (result, message) = _validator.Validate(username);
- result.Should().BeFalse();
- return message;
- }
-
- [Fact]
- public void NotString()
- {
- var (result, message) = _validator.Validate(123);
- result.Should().BeFalse();
- message.Should().ContainEquivalentOf("type");
- }
-
- [Fact]
- public void Empty()
- {
- FailAndMessage("").Should().ContainEquivalentOf("empty");
- }
-
- [Theory]
- [InlineData("!")]
- [InlineData("!abc")]
- [InlineData("ab c")]
- [InlineData("ab c!")] // This is a chinese ! .
- public void BadCharactor(string value)
- {
- FailAndMessage(value).Should().ContainEquivalentOf("invalid")
- .And.ContainEquivalentOf("character");
- }
-
- [Fact]
- public void TooLong()
- {
- FailAndMessage(new string('a', 40)).Should().ContainEquivalentOf("long");
- }
-
- [Fact(Skip = "Currently name can't be longer than 26. So this will print message of too long.")]
- public void UniqueId()
- {
- FailAndMessage("e4c80127d092d9b2fc19c5e04612d4c0").Should().ContainEquivalentOf("unique id");
- }
-
- [Theory]
- [InlineData(null)]
- [InlineData("abc")]
- [InlineData("-abc")]
- [InlineData("_abc")]
- [InlineData("abc-")]
- [InlineData("abc_")]
- [InlineData("a-bc")]
- [InlineData("a-b-c")]
- [InlineData("a-b_c")]
- [InlineData("a-你好_c")]
- public void Success(string value)
- {
- var (result, _) = _validator.Validate(value);
- result.Should().BeTrue();
- }
- }
-}
|