public void Get_Success() { //Arrange var modelToMirror = MappingGenerator.Create <BaseTest, BaseTestMirror>("Mirror", AcessibilityLevelEnum.@internal); var mirrorToModel = modelToMirror.GetReverse("Model"); var mirrorToModelPublic = modelToMirror.GetReverse("ModelPublic", AcessibilityLevelEnum.@public); var dir1 = Path.Combine(Directory.GetCurrentDirectory(), "output\\MirrorMappings\\"); var dir2 = Path.Combine(Directory.GetCurrentDirectory(), "output\\ModelMappings\\"); var dir3 = Path.Combine(Directory.GetCurrentDirectory(), "output\\ModelPublicMappings\\"); if (Directory.Exists(dir1)) { Directory.Delete(dir1, true); } if (Directory.Exists(dir2)) { Directory.Delete(dir2, true); } if (Directory.Exists(dir3)) { Directory.Delete(dir3, true); } //Act var result1 = modelToMirror.Generate(); var result2 = mirrorToModel.Generate(); var result3 = mirrorToModelPublic.Generate(); //Assert AssertDirectory(result1); AssertDirectory(result2); AssertDirectory(result3); }
static void Main(string[] args) { var mapGenerator = new MappingGenerator(); var mapper = mapGenerator.Create <Person, PersonVM>() .ForMember(from => from.Age, to => to.NumberOfYears) .ForMember(from => from.Name, to => to.FirstName); Person person = new Person() { Age = 22, IsStudent = true, Name = "Jessika", Surname = "White" }; var personVM = mapper.Map(person); }