Esempio n. 1
0
        public void ProvidedTwoFlatEntitiesWithKeyAttributesWithMatchingNamesProjectWorksOverQueryable_ProjectedEntity_NoException()
        {
            BasicEntityWithKeyAttributes entity = new BasicEntityWithKeyAttributes();
            entity.NumericId = 1;
            entity.Name = "Something";

            List<BasicEntityWithKeyAttributes> entityList = new List<BasicEntityWithKeyAttributes>() { entity };

            List<BasicEntityProjectionWithKeyAttribute> projectionList = entityList.ProjectEnumerable().To<BasicEntityProjectionWithKeyAttribute>().ToList();

            Assert.IsTrue(entityList.Count() == projectionList.Count(), message: "Same number of elements should be in both lists");
            Assert.IsTrue(entityList[0].NumericId.Equals(projectionList[0].NumericId), message: "NumericId should be exactly the same");
            Assert.IsTrue(entityList[0].Name == projectionList[0].Name, message: "Properties should be exactly the same");
        }
Esempio n. 2
0
        public void ProvidedTwoFlatEntitiesWithKeyAttributesWithMatchingNamesProjectWorks_ProjectedEntity_NoException()
        {
            BasicEntityWithKeyAttributes entity = new BasicEntityWithKeyAttributes();
            entity.NumericId = 1;
            entity.Name = "Something";

            BasicEntityProjectionWithKeyAttribute projection = entity.Project().To<BasicEntityProjectionWithKeyAttribute>();

            Assert.IsTrue(entity.NumericId.Equals(projection.NumericId), message: "NumericId should be exactly the same");
            Assert.IsTrue(entity.Name == projection.Name, message: "Properties should be exactly the same");
        }