summaryrefslogtreecommitdiffstats
path: root/tests/IOL.Fagprove.Tests/HelpersTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/IOL.Fagprove.Tests/HelpersTests.cs')
-rw-r--r--tests/IOL.Fagprove.Tests/HelpersTests.cs43
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