public void FillDbWithData() { using (var dbContext = new TPTUserDbContext(connectionString)) { var buisnessService = new BuisnessService(dbContext); loggerService.Info("registering new clients"); buisnessService.AddNewClient("Benzoline", "Cucumbersnatch", "89215135213", 1000); buisnessService.AddNewClient("John", "Smith", "85123163241", 500); buisnessService.AddNewClient("Lucifer", "Betrayer", "86669341246", 1500); buisnessService.AddNewClient("Viktor", "Chestinov", "89712351783", 2000); buisnessService.AddNewClient("Gennadiy", "Ikarov", "86123651231", 1700); buisnessService.AddNewClient("Valentina", "Pristavko", "+71426123612", 1200); buisnessService.AddNewClient("The God-Emperor", "Of Mankind", "+71426123612", 5000); buisnessService.AddNewClient("Patrissia", "Bublegum", "+71426123612", 100); loggerService.Info("Registering new stock types"); buisnessService.AddNewStockType("Rosal", 100); buisnessService.AddNewStockType("Nestle", 200); buisnessService.AddNewStockType("Tesla", 60); buisnessService.AddNewStockType("Blackguard", 50); buisnessService.AddNewStockType("Epic Games", 70); buisnessService.AddNewStockType("Sven", 53); buisnessService.AddNewStockType("Pioneer", 25); loggerService.Info("adding stocks to clients"); for (int i = 0; i < 100; i++) { buisnessService.AddStockToClient(buisnessService.GetStockTypes().GetRandom().Name, buisnessService.GetAllClients().GetRandom()); } } }
public void ShouldCallAddClientAndSaveChangesInOrder() { buisnessService.AddNewClient("Boba", "Biba", "777", 1000); Received.InOrder(() => { dataContextRepository.Received(1).Add(Arg.Any <Client>()); dataContextRepository.Received(1).SaveChanges(); }); }