-
Notifications
You must be signed in to change notification settings - Fork 0
topic 定数の持ち方 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
topic 定数の持ち方 #25
Conversation
f7q
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
レビュー
| [Fact] | ||
| public void Test3() | ||
| { | ||
| Assert.Equal("�R�{�R", this.helper.GetKbn<EnumSample>(EnumSample.KbnYamamoto)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文字化け修正する。
| Assert.Equal<int>(3, list.Count()); | ||
| Assert.Equal("test", list.ElementAt(0).Name); | ||
| Assert.Equal("aaaa", list.ElementAt(1).Name); | ||
| Assert.Equal("�R�{�R", list.ElementAt(2).Name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文字化け
| Assert.Equal("�R�{�R", list.ElementAt(2).Name); | ||
| Assert.Equal("1:test", list.ElementAt(0).IdAndName); | ||
| Assert.Equal("2:aaaa", list.ElementAt(1).IdAndName); | ||
| Assert.Equal("3:�R�{�R", list.ElementAt(2).IdAndName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文字化け
| public readonly static int Kbn1 = 1; | ||
| [Enum(Name = "aaaa", IdAndName = "2:aaaa")] | ||
| public readonly static string Kbn2 = "aaaa"; | ||
| [Enum(Name = "�R�{�R", IdAndName = "3:�R�{�R")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文字化け
| } | ||
| } | ||
|
|
||
| public class EnumSample |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
列挙定義クラスはひとつずつの方がリファクタリングしやすい
クラス定数として持つ場合の観点が変わってきている。
DDD本のValueObjectに類似している点として不変性を持つ、かつ多言語に応用するケースが多い。
リフレクションとアノテーションによる手段は邪道っぽいが・・・サンプルを追加。