Example #1
0
        public async void AddAsyncEntities_MultiRow_OK()
        {
            IEnumerable <Clientes> entities = new List <Clientes>()
            {
                new Clientes {
                    CIF = "000000009", Direccion = "to remove", Nombre = "555555", Mail = "*****@*****.**", FechaEntrada = DateTime.Today, FormaPago = "60 días"
                },
                new Clientes {
                    CIF = "000000009", Direccion = "to remove", Nombre = "555555", Mail = "*****@*****.**", FechaEntrada = DateTime.Today, FormaPago = "60 días"
                }
            };

            IEnumerable <Clientes> result = await instance.AddEntitiesAsync(entities);

            Assert.Equal(result.Count(), entities.Count());
            Assert.NotEqual(result.First().IdCliente, default(int));
            Assert.NotEqual(result.ElementAt(1).IdCliente, default(int));
        }
Example #2
0
        /// <summary>
        /// Add Async a sequence of items in DB, returns the new sequence of items from DB (EF)
        /// </summary>
        /// <param name="entities">Sequence of entities</param>
        /// <returns>Items Added with Identity values updated</returns>
        public Task <IEnumerable <TEntity> > AddEntitiesAsync(IEnumerable <TEntity> entities)
        {
            var result = efRepository.AddEntitiesAsync(entities);

            return(result);
        }