aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Mock/Services/MockStringLocalizer.cs
blob: 7729d56ce5c53d7ef4d6d33b7f57fa5ce033ca35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Microsoft.Extensions.Localization;
using System.Collections.Generic;
using System.Globalization;

namespace Timeline.Tests.Mock.Services
{
    public class MockStringLocalizer : IStringLocalizer
    {
        private const string mockKey = "MOCK_KEY";
        private const string mockString = "THIS IS A MOCK LOCALIZED STRING.";

        public LocalizedString this[string name] => new LocalizedString(name, mockString);

        public LocalizedString this[string name, params object[] arguments] => new LocalizedString(name, mockString);

        public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
        {
            yield return new LocalizedString(mockKey, mockString);
        }

        public IStringLocalizer WithCulture(CultureInfo culture)
        {
            return this;
        }
    }

    public class MockStringLocalizer<T> : MockStringLocalizer, IStringLocalizer<T>
    {

    }
}