-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
OSOE-60: .NET 6 and Orchard Core 1.3 upgrade
- Loading branch information
Showing
4 changed files
with
156 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
using Microsoft.Extensions.Localization; | ||
using System.Collections.Generic; | ||
|
||
namespace Moq.AutoMock | ||
namespace Moq.AutoMock; | ||
|
||
public static class AutoMockerExtensions | ||
{ | ||
public static class AutoMockerExtensions | ||
{ | ||
/// <summary> | ||
/// Register zero or more services with <see cref="AutoMocker.Use{TService}(TService)"/> as <see | ||
/// cref="IEnumerable{TService}"/>. This is to simulate the DI feature where you can inject all implementations | ||
/// of a given service as <see cref="IEnumerable{TService}"/>. | ||
/// </summary> | ||
/// <param name="mocker">The <see cref="AutoMocker"/> performing the registration.</param> | ||
/// <param name="objects">The collection of instances to be registered.</param> | ||
/// <typeparam name="T">The service type.</typeparam> | ||
public static void Some<T>(this AutoMocker mocker, params T[] objects) => mocker.Use<IEnumerable<T>>(objects); | ||
/// <summary> | ||
/// Register zero or more services with <see cref="AutoMocker.Use{TService}(TService)"/> as <see | ||
/// cref="IEnumerable{TService}"/>. This is to simulate the DI feature where you can inject all implementations of a | ||
/// given service as <see cref="IEnumerable{TService}"/>. | ||
/// </summary> | ||
/// <param name="mocker">The <see cref="AutoMocker"/> performing the registration.</param> | ||
/// <param name="objects">The collection of instances to be registered.</param> | ||
/// <typeparam name="T">The service type.</typeparam> | ||
public static void Some<T>(this AutoMocker mocker, params T[] objects) => mocker.Use<IEnumerable<T>>(objects); | ||
|
||
public static void MockStringLocalizer<T>(this AutoMocker mocker) => | ||
mocker.GetMock<IStringLocalizer<T>>() | ||
.Setup(localizer => localizer[It.IsAny<string>()]) | ||
.Returns<string>(parameter => new LocalizedString(parameter, parameter)); | ||
} | ||
public static void MockStringLocalizer<T>(this AutoMocker mocker) => | ||
mocker.GetMock<IStringLocalizer<T>>() | ||
.Setup(localizer => localizer[It.IsAny<string>()]) | ||
.Returns<string>(parameter => new LocalizedString(parameter, parameter)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters