public void TestAdd() { var dbConnection = AppConfigConnectionFactory.CreateSicConnection(); //using (dbConnection.BeginTransaction()) { var sut = new ConfigRepository(dbConnection); var expected = new LomoConfig { Name = "MyConfig", Description = "Description", Customer = new Customer("John", 0), Fields = new Collection<Field> { new Field {Name = "Test1", Description = "Description1"}, new Field {Name = "Test2", Description = "Description2"}, } }; var id = sut.Create(expected); expected.Id = id; var actual = sut.Get(id); Assert.Equal(expected, actual); } }
public static void CreateRandomUsers(ConfigRepository configRepo, int count) { Enumerable.Range(0, count) .ToList().ForEach( i => configRepo.Create( new User { UserName = "******" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5), Password = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5) })); Console.WriteLine("Created {0} users.", count); }