public Sport Add(Sport sport)
        {
            if (Exists(sport.Name))
            {
                throw new SportAlreadyExistsException();
            }

            SportEntity entity = mapper.ToEntity(sport);

            context.Entry(entity).State = EntityState.Added;
            context.SaveChanges();
            return(mapper.ToSport(entity));
        }
Exemple #2
0
        public void EntityToSportNameTest()
        {
            Sport converted = testMapper.ToSport(entity);

            Assert.AreEqual(converted.Name, sport.Object.Name);
        }