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

            return(entity);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 4
0
 public static T Create <T>(RandomObjectGenerator generator)
     where T : new()
 {
     return(EntityCreator.Create <T>(generator, null));
 }
Esempio n. 5
0
 public static T Create <T>()
     where T : new()
 {
     return(EntityCreator.Create <T>(new RandomObjectGenerator(), null));
 }