public void GetInstance_multiple()
        {
            MockEntity entity1 = new MockEntity()
            {
                id = 1
            };
            MockEntity entity2 = new MockEntity()
            {
                id = 2
            };
            List <MockEntity> entities = new List <MockEntity>()
            {
                entity1, entity2
            };
            DbEntityDataBundle dataBundle = DbEntityDataBundle.GetInstance(1, 0, entities);

            Assert.AreEqual(typeof(MockEntity), dataBundle.Type);
            Assert.AreEqual(1, dataBundle.Parameters.Count);
            Assert.IsTrue(dataBundle.Contains <List <MockEntity> >(DbEntityDataBundle.EntitiesParameterKey));
            Assert.IsFalse(dataBundle.Contains <MockEntity>(DbEntityDataBundle.EntityParameterKey));
            Assert.IsFalse(dataBundle.Contains <string>(DbEntityDataBundle.EntityJsonParameterKey));
            Assert.IsFalse(dataBundle.Contains <string>(DbEntityDataBundle.EntitiesJsonParameterKey));
            Assert.AreEqual(2, dataBundle.GetParameter <List <MockEntity> >(DbEntityDataBundle.EntitiesParameterKey).Count());
            Assert.IsTrue(dataBundle.GetParameter <List <MockEntity> >(DbEntityDataBundle.EntitiesParameterKey).Contains(entity1));
            Assert.IsTrue(dataBundle.GetParameter <List <MockEntity> >(DbEntityDataBundle.EntitiesParameterKey).Contains(entity2));
        }
        public void GetInstance_single()
        {
            MockEntity entity = new MockEntity()
            {
                id = 1
            };
            DbEntityDataBundle dataBundle = DbEntityDataBundle.GetInstance(1, 0, entity);

            Assert.AreEqual(typeof(MockEntity), dataBundle.Type);
            Assert.AreEqual(1, dataBundle.Parameters.Count);
            Assert.IsTrue(dataBundle.Contains <MockEntity>(DbEntityDataBundle.EntityParameterKey));
            Assert.IsFalse(dataBundle.Contains <string>(DbEntityDataBundle.EntityJsonParameterKey));
            Assert.IsFalse(dataBundle.Contains <List <MockEntity> >(DbEntityDataBundle.EntitiesParameterKey));
            Assert.IsFalse(dataBundle.Contains <string>(DbEntityDataBundle.EntitiesJsonParameterKey));
            Assert.AreEqual(entity, dataBundle.GetParameter <MockEntity>(DbEntityDataBundle.EntityParameterKey));
        }
        public void GetPrimaryKeys()
        {
            MockEntity entity1 = new MockEntity()
            {
                id = 1
            };
            MockEntity entity2 = new MockEntity()
            {
                id = 2
            };
            List <MockEntity> entities = new List <MockEntity>()
            {
                entity1, entity2
            };
            DbEntityDataBundle dataBundle = DbEntityDataBundle.GetInstance(1, 0, entities);

            IEnumerable <Tuple <string, object>[]> primaryKeys = dataBundle.GetPrimaryKeys();

            Assert.AreEqual(2, primaryKeys.Count());
            Assert.IsTrue(primaryKeys.Any(ks => ks.All(k => k.Item2.Equals(entity1.id))));
            Assert.IsTrue(primaryKeys.Any(ks => ks.All(k => k.Item2.Equals(entity2.id))));
        }