示例#1
0
        public static T Create <T>(Action <T> modifier)
            where T : new()
        {
            var entity = EntityCreator.Create <T>(new RandomObjectGenerator(), modifier);

            return(entity);
        }
示例#2
0
        public void Insert()
        {
            var entity = EntityCreator.Create <MoqExample>();

            context.Object.MoqExamples.Add(entity);

            context.Object.SaveChanges();

            Assert.AreEqual(5, context.Object.MoqExamples.ToList().Count);
        }
示例#3
0
        public void TestInitialize()
        {
            context = new Mock <DbMoqExample>();

            entities = new List <MoqExample>();

            entities.Add(EntityCreator.Create <MoqExample>());
            entities.Add(EntityCreator.Create <MoqExample>());
            entities.Add(EntityCreator.Create <MoqExample>());
            entities.Add(EntityCreator.Create <MoqExample>());

            var MoqExamples = new Mock <DbSet <MoqExample> >(MockBehavior.Strict).SetupData(entities);

            context.SetupGet(x => x.MoqExamples).Returns(MoqExamples.Object);
        }
示例#4
0
 public static void Update <T>(T entity, RandomObjectGenerator generator)
 {
     EntityCreator.Update <T>(entity, generator, null);
 }
示例#5
0
 public static void Update <T>(T entity, Action <T> modifier)
 {
     EntityCreator.Update <T>(entity, new RandomObjectGenerator(), modifier);
 }
示例#6
0
 public static void Update <T>(T entity)
 {
     EntityCreator.Update <T>(entity, new RandomObjectGenerator(), null);
 }
示例#7
0
 public static T Create <T>(RandomObjectGenerator generator)
     where T : new()
 {
     return(EntityCreator.Create <T>(generator, null));
 }
示例#8
0
 public static T Create <T>()
     where T : new()
 {
     return(EntityCreator.Create <T>(new RandomObjectGenerator(), null));
 }