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

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