Example #1
0
        public void MapPrimitive_Expected_PathToRoot()
        {
            PocoMapper          pocoMapper = new PocoMapper();
            IEnumerable <IPath> paths      = pocoMapper.Map(1);

            Assert.IsTrue(paths.Any(p => p.ActualPath == PocoPath.SeperatorSymbol));
        }
Example #2
0
        public void MapReferenceType_WhereGetAccessorsOfMembersThrowExceptions_Expected_PathsToExcludeThoseMembers()
        {
            PocoMapper          pocoMapper = new PocoMapper();
            Uri                 uri        = new Uri("/Cake", UriKind.Relative);
            IEnumerable <IPath> paths      = pocoMapper.Map(uri);

            Assert.IsFalse(paths.Any(p => p.ActualPath == "Host"));
        }
Example #3
0
        public void MapReferenceTypeNestedEnumerableAnWithinEnumerable_Expected_PathToPublicPrimitiveMemberOfNestedPublicEnumerableMember()
        {
            PocoTestData testData = GivenWithParallelAndNestedEnumerables();

            PocoMapper          pocoMapper = new PocoMapper();
            IEnumerable <IPath> paths      = pocoMapper.Map(testData);

            Assert.IsTrue(paths.Any(p => p.ActualPath == "EnumerableData().EnumerableData().Name"));
        }
Example #4
0
        public void MapNestedReferenceType_Expected_PathToPublicPrimitiveMemberOfNestedPublicReferenceMember()
        {
            PocoTestData testData = Given();

            PocoMapper          pocoMapper = new PocoMapper();
            IEnumerable <IPath> paths      = pocoMapper.Map(testData);

            Assert.IsTrue(paths.Any(p => p.ActualPath == "NestedData.Name"));
        }
Example #5
0
        public void MapEnumerableNestedInAnEnumerable_Expected_PathToPublicPrimitiveMemberOfEnumerableNestedInTheOuterEnumerable()
        {
            PocoMapper   pocoMapper = new PocoMapper();
            PocoTestData testData   = GivenWithParallelAndNestedEnumerables();

            IEnumerable <IPath> paths = pocoMapper.Map(testData);

            Assert.IsTrue(paths.Any(p => p.ActualPath == "EnumerableData().EnumerableData.Count"));
        }
Example #6
0
        public void MapEnumerable_Expected_PathToPublicPrimitiveMember()
        {
            PocoMapper pocoMapper = new PocoMapper();
            List <int> primitives = new List <int>();

            IEnumerable <IPath> paths = pocoMapper.Map(primitives);

            Assert.IsTrue(paths.Any(p => p.ActualPath == "Count"));
        }
Example #7
0
        public void MapEnumerable_Expected_PathToEnumerable()
        {
            var pocoMapper = new PocoMapper();
            var testData   = GivenWithParallelAndNestedEnumerables();

            var paths = pocoMapper.Map(testData.EnumerableData);

            Assert.IsTrue(paths.Any(p => p.ActualPath == "UnnamedArray().Name"));
        }
Example #8
0
        public void MapReferenceTypeNestedInAnWithinEnumerable_Expected_PathToPublicPrimitiveMemberOfPublicReferenceMemberOfPublicEnumerableMember()
        {
            var testData = Given();

            var pocoMapper = new PocoMapper();
            var paths      = pocoMapper.Map(testData);

            Assert.IsTrue(paths.Any(p => p.ActualPath == "EnumerableData().NestedData.Name"));
        }
Example #9
0
        public void MapReferenceType_Expected_PathToPublicPrimitiveMemberOfPublicReferenceMember()
        {
            var testData = Given();

            var pocoMapper = new PocoMapper();
            var paths      = pocoMapper.Map(testData);

            Assert.IsTrue(paths.Any(p => p.ActualPath == "Name"));
        }
Example #10
0
        public void MapEnumerableOnlyContainingPrimitives_Expected_PathToRoot()
        {
            PocoMapper pocoMapper = new PocoMapper();
            List <int> primitives = new List <int> {
                1, 2, 3
            };
            IEnumerable <IPath> paths = pocoMapper.Map(primitives);

            Assert.IsTrue(paths.Any(p => p.ActualPath == PocoPath.EnumerableSymbol + PocoPath.SeperatorSymbol));
        }
Example #11
0
        public void MapEnumerableOnlyContainingPrimitives_Expected_PathToRoot()
        {
            var pocoMapper = new PocoMapper();
            var primitives = new List <int> {
                1, 2, 3
            };
            var paths = pocoMapper.Map(primitives);

            Assert.IsTrue(paths.Any(p => p.ActualPath == "Capacity" || p.ActualPath == "Count"));
        }