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

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