public TestFeature() { _mapper = new AttributeMapper(this); Item1 = true; Item2 = "The quick brown fox jumped over the fence."; Item3 = double.Epsilon; Item4 = new[] { 1, 2, 3, 4 }; }
public void Map_MapperTarget_MapsCorrectly() { string expectedName = "Test Name"; int expectedCode = 412; var a = new TestClassA {Code = expectedCode, Name = expectedName}; var d = new TestClassD(); var target = new AttributeMapper<TestClassA, TestClassD>(); target.Map(a, d); Assert.AreEqual(expectedName, d.SomeOtherName); Assert.AreEqual(expectedCode, d.AnotherCode); Assert.AreEqual(expectedName, a.Name); Assert.AreEqual(expectedCode, a.Code); }
public void Map_MapperTarget_MapsCorrectly() { string expectedName = "Test Name"; int expectedCode = 412; var a = new TestClassA { Code = expectedCode, Name = expectedName }; var d = new TestClassD(); var target = new AttributeMapper <TestClassA, TestClassD>(); target.Map(a, d); Assert.AreEqual(expectedName, d.SomeOtherName); Assert.AreEqual(expectedCode, d.AnotherCode); Assert.AreEqual(expectedName, a.Name); Assert.AreEqual(expectedCode, a.Code); }
public void Map_MappedSource_SkipsMapping() { string expectedName = "Test Name"; int expectedCode = 412; var a = new TestClassA(); var d = new TestClassD {AnotherCode = expectedCode, SomeOtherName = expectedName}; var target = new AttributeMapper<TestClassD, TestClassA>(); target.Map(d, a); Assert.AreEqual(expectedName, d.SomeOtherName); Assert.AreEqual(expectedCode, d.AnotherCode); Assert.AreEqual(expectedName, a.Name); // since the mapping direction for AnotherCode is "TargetMemberName" only, // a.Code should be left with its default sourceValue. Assert.AreEqual(0, a.Code); }
public void Map_MappedSource_SkipsMapping() { string expectedName = "Test Name"; int expectedCode = 412; var a = new TestClassA(); var d = new TestClassD { AnotherCode = expectedCode, SomeOtherName = expectedName }; var target = new AttributeMapper <TestClassD, TestClassA>(); target.Map(d, a); Assert.AreEqual(expectedName, d.SomeOtherName); Assert.AreEqual(expectedCode, d.AnotherCode); Assert.AreEqual(expectedName, a.Name); // since the mapping direction for AnotherCode is "TargetMemberName" only, // a.Code should be left with its default sourceValue. Assert.AreEqual(0, a.Code); }
public virtual async Task Setup() { //create some dummy attributes t = new Attribute() { Location = "1", Hash = "1", Content = new StringContent("Olivier") }; Certificate nameCert = new Certificate() { Owner = "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", Revoked = false, Location = "certLocation", Hash = "certHash", Content = new StringContent("I certify that this is his real name.") }; Certificate nameCert2 = new Certificate() { Owner = "0x1FD8397e8108ada12eC07976D92F773364ba46e7", Revoked = false, Location = "certLocation2", Hash = "certHash2", Content = new StringContent("I certify that this is his real name 2.") }; t.AddCertificate(nameCert); t.AddCertificate(nameCert2); IFile file = await FileSystem.Current.LocalStorage.CreateFileAsync("mydata.db", CreationCollisionOption.ReplaceExisting); var path = file.Path; Mapper = new AttributeMapper(path, new ExternalElementMapper<Certificate>(path)); }
public AttributeFileRepository(IFileReader loader, AttributeMapper mapper) : base(loader, mapper) { }