public static T Create <T>(Action <T> modifier) where T : new() { var entity = EntityCreator.Create <T>(new RandomObjectGenerator(), modifier); return(entity); }
public void Insert() { var entity = EntityCreator.Create <MoqExample>(); context.Object.MoqExamples.Add(entity); context.Object.SaveChanges(); Assert.AreEqual(5, context.Object.MoqExamples.ToList().Count); }
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); }
public static void Update <T>(T entity, RandomObjectGenerator generator) { EntityCreator.Update <T>(entity, generator, null); }
public static void Update <T>(T entity, Action <T> modifier) { EntityCreator.Update <T>(entity, new RandomObjectGenerator(), modifier); }
public static void Update <T>(T entity) { EntityCreator.Update <T>(entity, new RandomObjectGenerator(), null); }
public static T Create <T>(RandomObjectGenerator generator) where T : new() { return(EntityCreator.Create <T>(generator, null)); }
public static T Create <T>() where T : new() { return(EntityCreator.Create <T>(new RandomObjectGenerator(), null)); }