From 3f4c0720e1e3421431e7baa20882a4a4512a7fab Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 19 Oct 2025 23:41:23 +0200 Subject: Initial --- tests/IOL.Fagprove.Tests/HelpersTests.cs | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/IOL.Fagprove.Tests/HelpersTests.cs (limited to 'tests/IOL.Fagprove.Tests/HelpersTests.cs') 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 -- cgit v1.3