public void SetUp() { _context = new DataContext(); _store = new Store() {StoreName = "TestStore"}; _loginRepository = new LoginRepository(_context); _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;"; _context.Database.ExecuteSqlCommand("dbo.TestCleanTable"); _context.Stores.Add(_store); _login = new Login() { Username = "******", Password = "******", Store = _store }; _context.Logins.Add(_login); _context.SaveChanges(); _passwd = new SecureString(); _passwd.AppendChar('p'); _passwd.AppendChar('a'); _passwd.AppendChar('s'); _passwd.AppendChar('s'); _passwd.AppendChar('w'); _passwd.AppendChar('d'); }
public void SetUp() { _context = new DataContext(); _unit = new UnitOfWork(_context); _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;MultipleActiveResultSets=True;"; _context.Database.ExecuteSqlCommand("dbo.TestCleanTable"); //Opsætning af 2 forretninger der begge har samme vare _product = new Product() { ProductName = "TestProduct" }; _store = new Store() { StoreName = "TestStore" }; _store1 = new Store() { StoreName = "TestStore1" }; _context.Products.Add(_product); _context.Stores.Add(_store); _context.Stores.Add(_store1); _context.SaveChanges(); _hasA = new HasA() { Product = _product, Store = _store, ProductId = _product.ProductId, StoreId = _store.StoreId, Price = 12 }; _hasA1 = new HasA() { Product = _product, Store = _store1, ProductId = _product.ProductId, StoreId = _store1.StoreId, Price = 13 }; _context.HasARelation.Add(_hasA); _context.HasARelation.Add(_hasA1); _context.SaveChanges(); _consumer = new Consumer.Consumer(_unit); }
public void SetUp() { _context = new DataContext(); _unit = new UnitOfWork(_context); _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;"; _context.Database.ExecuteSqlCommand("dbo.TestCleanTable"); var store = new Store() { StoreName = "TestStore" }; _context.Stores.Add(store); _context.SaveChanges(); _storemanager = new Storemanager(_unit, store); }
public void SetUp() { _context = new DataContext(); _unit = new UnitOfWork(_context); _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;MultipleActiveResultSets=True;"; _context.Database.ExecuteSqlCommand("dbo.TestCleanTable"); _store = new Store() { StoreName = "TestStore" }; _autocomplete = new Autocomplete(_unit); _msgBox = Substitute.For<ICreateMsgBox>(); _context.Stores.Add(_store); _context.SaveChanges(); _storemanager = new Storemanager(_unit, _store); _newProduct = new NewProductModel(_storemanager, _autocomplete, _msgBox ); _context.Products.Add(new Product() {ProductName = "Test"}); _context.Products.Add(new Product() { ProductName = "Test2" }); _context.SaveChanges(); }
public void SetUp() { _context = new DataContext(); _unit = new UnitOfWork(_context); _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;MultipleActiveResultSets=True;"; _context.Database.ExecuteSqlCommand("dbo.TestCleanTable"); var store = new Store() {StoreName = "TestStore"}; var store2 = new Store() { StoreName = "TestStore2" }; _context.Stores.Add(store); _context.Stores.Add(store2); _context.SaveChanges(); _product = new Product() {ProductName = "Test"}; _product2 = new Product() {ProductName = "Test2"}; var hasA = new HasA() {Price = 4, Product = _product, Store = store}; var hasA2 = new HasA() {Price = 6, Product = _product2, Store = store}; var hasA3 = new HasA() { Price = 5, Product = _product, Store = store2 }; _context.Products.Add(_product); _context.Products.Add(_product2); _context.HasARelation.Add(hasA2); _context.HasARelation.Add(hasA); _context.HasARelation.Add(hasA3); _context.SaveChanges(); _consumer = new global::Consumer.Consumer(_unit); _mail = Substitute.For<IMail>(); _autocomplete = new Autocomplete(_unit); _generatedShoppingList = new GeneratedShoppingListModel(_consumer, _mail); _shoppingList = new ShoppingListModel(_consumer, _autocomplete); _findProduct = new FindProductModel(_consumer, _autocomplete); _shoppingList.ClearShoppingListCommand.Execute(this); }