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

            return(entity);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #4
0
 public static void Update <T>(T entity, RandomObjectGenerator generator)
 {
     EntityCreator.Update <T>(entity, generator, null);
 }
Exemple #5
0
 public static void Update <T>(T entity, Action <T> modifier)
 {
     EntityCreator.Update <T>(entity, new RandomObjectGenerator(), modifier);
 }
Exemple #6
0
 public static void Update <T>(T entity)
 {
     EntityCreator.Update <T>(entity, new RandomObjectGenerator(), null);
 }
Exemple #7
0
 public static T Create <T>(RandomObjectGenerator generator)
     where T : new()
 {
     return(EntityCreator.Create <T>(generator, null));
 }
Exemple #8
0
 public static T Create <T>()
     where T : new()
 {
     return(EntityCreator.Create <T>(new RandomObjectGenerator(), null));
 }