public void ForKeyFromNestedClassMixedWithStructsPropertyShouldAddNewErrorWithProperName() { var errors = new ResultErrorsDictionary(); errors.Add <Model>(m => m.PropertyB.PropertyC.PropertyD, "value"); errors.Should().BeEquivalentTo(new Dictionary <string, string[]> { [$"Model.{nameof(Model.PropertyB)}.{nameof(Model.PropertyB.PropertyC)}.{nameof(Model.PropertyB.PropertyC.PropertyD)}"] = new[] { "value" } }); }
public void ForKeyFromNestedCollectionsWithIndexersShouldAddNewErrorWithProperName() { var errors = new ResultErrorsDictionary(); errors.Add <Model>(m => m.CollectionA[0].CollectionB[0].PropertyD, "value"); errors.Should().BeEquivalentTo(new Dictionary <string, string[]> { [$"Model.{nameof(Model.CollectionA)}.{nameof(Model.PropertyB.CollectionB)}.{nameof(Model.PropertyB.PropertyC.PropertyD)}"] = new[] { "value" } }); }
public void ForKeyFromClassPropertyShouldAddNewErrorWithProperName() { var errors = new ResultErrorsDictionary(); errors.Add <Model>(m => m.PropertyA, "value"); errors.Should().BeEquivalentTo(new Dictionary <string, string[]> { [$"Model.{nameof(Model.PropertyA)}"] = new[] { "value" } }); }