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));
        }
Beispiel #2
0
        public void SportToEntityNameTest()
        {
            SportEntity converted = testMapper.ToEntity(sport.Object);

            Assert.AreEqual(converted.Name, entity.Name);
        }