Skip to content

Commit 5109f01

Browse files
committed
feat: create custom inline data to test a theory
1 parent 534c4e8 commit 5109f01

2 files changed

Lines changed: 72 additions & 18 deletions

File tree

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,60 @@
1-
namespace RecipesApp.Exception.Resources;
1+
using System.Globalization;
2+
3+
namespace RecipesApp.Exception.Resources;
24

35
public static class ResourcesAccessor
46
{
5-
public static string EMAIL_ALREADY_REGISTERED { get
6-
=> ExceptionMessagesResource.EMAIL_ALREADY_REGISTERED; }
7-
public static string EMAIL_INVALID { get
8-
=> ExceptionMessagesResource.EMAIL_INVALID; }
9-
public static string EMAIL_REQUIRED { get
10-
=> ExceptionMessagesResource.EMAIL_REQUIRED; }
11-
public static string NAME_REQUIRED { get
12-
=> ExceptionMessagesResource.NAME_REQUIRED; }
13-
public static string PASSWORD_LENGTH { get
14-
=> ExceptionMessagesResource.PASSWORD_LENGTH; }
15-
public static string PASSWORD_REQUIRED { get
16-
=> ExceptionMessagesResource.PASSWORD_REQUIRED; }
17-
public static string UNKNOWN_ERROR { get
18-
=> ExceptionMessagesResource.UNKNOWN_ERROR; }
19-
public static string SERVICE_FAIL { get
20-
=> ExceptionMessagesResource.SERVICE_FAIL; }
21-
}
7+
public static string EMAIL_ALREADY_REGISTERED
8+
{
9+
get
10+
=> ExceptionMessagesResource.EMAIL_ALREADY_REGISTERED;
11+
}
12+
13+
public static string EMAIL_INVALID
14+
{
15+
get
16+
=> ExceptionMessagesResource.EMAIL_INVALID;
17+
}
18+
19+
public static string EMAIL_REQUIRED
20+
{
21+
get
22+
=> ExceptionMessagesResource.EMAIL_REQUIRED;
23+
}
24+
25+
public static string NAME_REQUIRED
26+
{
27+
get
28+
=> ExceptionMessagesResource.NAME_REQUIRED;
29+
}
30+
31+
public static string PASSWORD_LENGTH
32+
{
33+
get
34+
=> ExceptionMessagesResource.PASSWORD_LENGTH;
35+
}
36+
37+
public static string PASSWORD_REQUIRED
38+
{
39+
get
40+
=> ExceptionMessagesResource.PASSWORD_REQUIRED;
41+
}
42+
43+
public static string UNKNOWN_ERROR
44+
{
45+
get
46+
=> ExceptionMessagesResource.UNKNOWN_ERROR;
47+
}
48+
49+
public static string SERVICE_FAIL
50+
{
51+
get
52+
=> ExceptionMessagesResource.SERVICE_FAIL;
53+
}
54+
55+
public static string GetMessageByCulture(string field, string? culture)
56+
{
57+
var cultureInfo = new CultureInfo(culture ?? "en");
58+
return ExceptionMessagesResource.ResourceManager.GetString(field, cultureInfo)!;
59+
}
60+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Collections;
2+
3+
namespace API.Test.InlineData;
4+
5+
internal class CultureInlineData : IEnumerable<object?[]>
6+
{
7+
public IEnumerator<object?[]> GetEnumerator()
8+
{
9+
yield return [null];
10+
yield return ["en-US"];
11+
yield return ["pt-BR"];
12+
}
13+
14+
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
15+
}

0 commit comments

Comments
 (0)