From 38734a0ccff15c39a0a34bf52ec4ad34a9aac2d9 Mon Sep 17 00:00:00 2001
From: Axemasta <33064621+Axemasta@users.noreply.github.com>
Date: Wed, 3 Apr 2024 16:42:52 +0100
Subject: [PATCH] Rider Refactor
A final refactor for all of the changes made
---
.../MockNavigationService.cs | 17 +++---
.../SetupNavigationExtensions.cs | 21 ++++---
.../VerifyNavigationExtensions.cs | 2 +-
.../EquivalenceHelperTests.cs | 55 +++++++++----------
4 files changed, 51 insertions(+), 44 deletions(-)
diff --git a/src/Moq.INavigationService/MockNavigationService.cs b/src/Moq.INavigationService/MockNavigationService.cs
index 612ef82..7034399 100644
--- a/src/Moq.INavigationService/MockNavigationService.cs
+++ b/src/Moq.INavigationService/MockNavigationService.cs
@@ -2,43 +2,44 @@
namespace Moq;
///
-/// Mock Navigation Service, Capable of mocking the during a unit test.
+/// Mock Navigation Service, Capable of mocking the during a unit
+/// test.
///
public class MockNavigationService : Mock, INavigationService, IRegistryAware
{
#region INavigationService
- ///
+ ///
public Task GoBackAsync(INavigationParameters parameters)
{
return Object.GoBackAsync(parameters);
}
- ///
+ ///
public Task GoBackAsync(string viewName, INavigationParameters parameters)
{
return Object.GoBackAsync(viewName, parameters);
}
- ///
+ ///
public Task GoBackToAsync(string name, INavigationParameters parameters)
{
return Object.GoBackToAsync(name, parameters);
}
- ///
+ ///
public Task GoBackToRootAsync(INavigationParameters parameters)
{
return Object.GoBackToRootAsync(parameters);
}
- ///
+ ///
public Task NavigateAsync(Uri uri, INavigationParameters parameters)
{
return Object.NavigateAsync(uri, parameters);
}
- ///
+ ///
public Task SelectTabAsync(string name, INavigationParameters parameters)
{
return Object.SelectTabAsync(name, parameters);
@@ -48,7 +49,7 @@ public Task SelectTabAsync(string name, INavigationParameters
#region IRegistryAware
- ///
+ ///
public IViewRegistry Registry { get; } = new MockViewRegistry();
#endregion IRegistryAware
diff --git a/src/Moq.INavigationService/SetupNavigationExtensions.cs b/src/Moq.INavigationService/SetupNavigationExtensions.cs
index 5bc7df8..2976e25 100644
--- a/src/Moq.INavigationService/SetupNavigationExtensions.cs
+++ b/src/Moq.INavigationService/SetupNavigationExtensions.cs
@@ -3,7 +3,7 @@
namespace Moq;
///
-/// Setup Methods For The Mock
+/// Setup Methods For The Mock
///
public static class SetupNavigationExtensions
{
@@ -26,7 +26,8 @@ public static void SetupAllNavigationReturns(this Mock navig
}
///
- /// This setup method will ensure all navigation calls will return a failed with the given exception.
+ /// This setup method will ensure all navigation calls will return a failed
+ /// with the given exception.
///
/// The mock navigation service
/// The exception that caused the navigation failure
@@ -45,7 +46,7 @@ public static void SetupAllNavigationFails(this Mock navigat
}
///
- /// Setup Navigation For The Given
+ /// Setup Navigation For The Given
///
/// The mock navigation service
/// The destination uri
@@ -56,7 +57,7 @@ public static ISetup> SetupNavigatio
}
///
- /// Setup Navigation For The Given &
+ /// Setup Navigation For The Given &
///
/// The mock navigation service
/// The destination uri
@@ -73,7 +74,10 @@ public static ISetup> SetupNavigatio
/// The mock navigation service
/// The destination string
/// Moq Setup
- /// This will be thrown if the string is not a valid
+ ///
+ /// This will be thrown if the string is not a valid
+ ///
+ ///
public static ISetup> SetupNavigation(this Mock navigationServiceMock, string destination)
{
if (!Uri.TryCreate(destination, UriKind.RelativeOrAbsolute, out var destinationUri))
@@ -85,13 +89,16 @@ public static ISetup> SetupNavigatio
}
///
- /// Setup Navigation For The Given Destination String &
+ /// Setup Navigation For The Given Destination String &
///
/// The mock navigation service
/// The destination string
/// The expected parameters
/// Moq Setup
- /// This will be thrown if the string is not a valid
+ ///
+ /// This will be thrown if the string is not a valid
+ ///
+ ///
public static ISetup> SetupNavigation(this Mock navigationServiceMock, string destination, INavigationParameters navigationParameters)
{
if (!Uri.TryCreate(destination, UriKind.RelativeOrAbsolute, out var destinationUri))
diff --git a/src/Moq.INavigationService/VerifyNavigationExtensions.cs b/src/Moq.INavigationService/VerifyNavigationExtensions.cs
index 69ac095..5340eda 100644
--- a/src/Moq.INavigationService/VerifyNavigationExtensions.cs
+++ b/src/Moq.INavigationService/VerifyNavigationExtensions.cs
@@ -4,7 +4,7 @@
namespace Moq;
///
-/// Setup Methods For The Mock
+/// Setup Methods For The Mock
///
public static class VerifyNavigationExtensions
{
diff --git a/tests/Moq.INavigationService.Tests/EquivalenceHelperTests.cs b/tests/Moq.INavigationService.Tests/EquivalenceHelperTests.cs
index 22d645e..338a016 100644
--- a/tests/Moq.INavigationService.Tests/EquivalenceHelperTests.cs
+++ b/tests/Moq.INavigationService.Tests/EquivalenceHelperTests.cs
@@ -26,66 +26,65 @@ public void AreEquivalent_Should_DetermineCorrectly(object? a, object? b, bool e
{
{
// Both are null, expect true
- null,
- null,
- true
+ null, null, true
},
{
// Both object are Uri, same value, expect true
- new Uri("navigation://NavigationPage/HomePage"),
- new Uri("navigation://NavigationPage/HomePage"),
- true
+ new Uri("navigation://NavigationPage/HomePage"), new Uri("navigation://NavigationPage/HomePage"), true
},
{
// One object is Uri, other is null, expect false
- new Uri("navigation://NavigationPage/HomePage"),
- null,
- false
+ new Uri("navigation://NavigationPage/HomePage"), null, false
},
{
// One object is Uri, other is null, expect false
- null,
- new Uri("navigation://NavigationPage/HomePage"),
- false
+ null, new Uri("navigation://NavigationPage/HomePage"), false
},
{
// Both object are Uri, different values, expect false
- new Uri("navigation://NavigationPage/HomePage"),
- new Uri("https://www.github.com"),
- false
+ new Uri("navigation://NavigationPage/HomePage"), new Uri("https://www.github.com"), false
},
{
// Both object are NavigationParameters, same values, expect true
- new NavigationParameters()
+ new NavigationParameters
{
- { "KeyOne", "Hello World" },
+ {
+ "KeyOne", "Hello World"
+ },
},
- new NavigationParameters()
+ new NavigationParameters
{
- { "KeyOne", "Hello World" },
+ {
+ "KeyOne", "Hello World"
+ },
},
true
},
{
// Both object are NavigationParameters, different values, expect false
- new NavigationParameters()
+ new NavigationParameters
{
- { "KeyOne", "Hello World" },
+ {
+ "KeyOne", "Hello World"
+ },
},
- new NavigationParameters()
+ new NavigationParameters
{
- { "ThisIsANumber", 1928 },
+ {
+ "ThisIsANumber", 1928
+ },
},
false
},
{
// One object is INavigationParameters, other is null, expect false
- new NavigationParameters()
+ new NavigationParameters
{
- { "KeyOne", "Hello World" },
+ {
+ "KeyOne", "Hello World"
+ },
},
- null,
- false
- }
+ null, false
+ },
};
}