diff options
| author | ivar <i@oiee.no> | 2025-10-19 23:41:23 +0200 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2025-10-19 23:41:23 +0200 |
| commit | 3f4c0720e1e3421431e7baa20882a4a4512a7fab (patch) | |
| tree | 734ca81d7d0841d8863e3f523ebba14c282dc681 /tests/IOL.Fagprove.Tests/HelpersTests.cs | |
| download | fagprove-master.tar.xz fagprove-master.zip | |
Diffstat (limited to 'tests/IOL.Fagprove.Tests/HelpersTests.cs')
| -rw-r--r-- | tests/IOL.Fagprove.Tests/HelpersTests.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/IOL.Fagprove.Tests/HelpersTests.cs b/tests/IOL.Fagprove.Tests/HelpersTests.cs new file mode 100644 index 0000000..cbc991b --- /dev/null +++ b/tests/IOL.Fagprove.Tests/HelpersTests.cs @@ -0,0 +1,43 @@ +using System; +using IOL.Fagprove.Data.Enums; +using IOL.Fagprove.Utilities; +using Xunit; + +namespace PIT.ReservationService.Tests +{ + public class HelpersTests + { + private const string InvalidGuid = "asdf"; + private const string ValidGuid = "c3c67267-60c5-4ed7-a754-61d189430da1"; + private const string ValidUserRole = "1"; + private const string InvalidUserRole = "12312as"; + + [Fact] + public void ToGuidReturnsDefaultGivenInvalidGuid() + { + var guid = InvalidGuid.ToGuid(); + Assert.StrictEqual(default, guid); + } + + [Fact] + public void ToGuidReturnsGuidGivenValidGuid() + { + var guid = ValidGuid.ToGuid(); + Assert.StrictEqual(new Guid(ValidGuid), guid); + } + + [Fact] + public void ToUserRoleReturnsDefaultOnInvalidString() + { + var userRole = InvalidUserRole.ToUserRole(); + Assert.StrictEqual(default, userRole); + } + + [Fact] + public void ToUserRoleReturnsUserRoleOnValidString() + { + var userRole = ValidUserRole.ToUserRole(); + Assert.StrictEqual(UserRole.Administrator, userRole); + } + } +}
\ No newline at end of file |
