Exemplo n.º 1
0
        public void TaxonMapTest()
        {
            // Arrange
            var mockPhotoMapper = new Mock<IMapper<Photo>>().Object;
            var taxonMapper = new TaxonMapper(mockPhotoMapper);

            dynamic commonName = new JObject();
            commonName.name = "Slender Seahorse";

            dynamic obj = new JObject();
            obj.id = "101";
            obj.wikipedia_summary = "Pretty!";
            obj.name = "Hippocampus Reidi";
            obj.common_name = commonName;
            obj.taxon_range_kml_url = "http://iseahorse.org/kml";

            var taxon = new Taxon();            

            // Act
            taxonMapper.Map(obj, taxon);

            // Assert
            Assert.AreEqual(taxon.Id, 101);
            Assert.AreEqual(taxon.Summary, "Pretty!");
            Assert.AreEqual(taxon.ScientificName, "Hippocampus Reidi");
            Assert.AreEqual(taxon.CommonName, "Slender Seahorse");
            Assert.AreEqual(taxon.RangeKmlUri, new Uri("http://iseahorse.org/kml"));
            Assert.AreEqual(taxon.Photos.Count, 0);
        }
 public iNaturalistMapperFactory()
 {
     CommentMapper = new CommentMapper();
     PhotoMapper = new PhotoMapper();
     TaxonMapper = new TaxonMapper(PhotoMapper);
     IdentificationMapper = new IdentificationMapper(TaxonMapper);
     UserMapper = new UserMapper();
     ObservationMapper = new ObservationMapper(CommentMapper, IdentificationMapper,
         PhotoMapper, TaxonMapper, UserMapper);
 }