public void SetUp()
 {
     _context = new DataContext();
     _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
     _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
     _unitOfWork = new UnitOfWork(_context);
 }
        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");

            _databaseFunctions = new DatabaseFunctions(_unit);

            _consumerView = new ConsumerViewModel(new global::Consumer.Consumer(_unit), new Autocomplete(_unit), _databaseFunctions  );
        }
        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();
     _prod = new Product() {ProductName = "Test"};
     _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
     _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
     _productRepository = new ProductRepository(_context);
 }
        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()
        {
            var context = new DataContext();
            _unit = new UnitOfWork(context);
            context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
            context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
            _store = new Store() {StoreName = "TestStore"};
            _unit.Stores.Add(_store);
            _product = new Product() {ProductName = "Testproduct"};
            _unit.Products.Add(_product);
            _unit.Complete();
            _unit.HasA.Add(new HasA() {Product = _product, ProductId = _product.ProductId, Store = _store, StoreId = _store.StoreId, Price = 10});
            _unit.Complete();

            _manager = new Storemanager(_unit, _store);
            _autocomplete = new Autocomplete(_unit);
            _createMsgBox = Substitute.For<ICreateMsgBox>();
            _changePriceModel = new ChangePriceModel(_manager, _autocomplete, _createMsgBox);
            _deleteProductModel = new DeleteProductModel(_manager, _autocomplete, _createMsgBox);
        }
        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();
            _unitOfWork = new UnitOfWork(_context);
            _autocomplete = new Autocomplete(_unitOfWork);
            _msgBox = Substitute.For<ICreateMsgBox>();
            _admin = new Admin(_unitOfWork);
            _adminDeleteStoreModel = new AdminDeleteStoreModel(_admin, _autocomplete, _msgBox);
            _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
            _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
            _secureStringTest.AppendChar('A');
            _secureStringTest.AppendChar('B');
            _secureStringTest.AppendChar('C');

            _admin.CreateLogin("Teststore", _secureStringTest, "Teststore");
            _msgBox.DeleteStoreMgsConfirmation("Teststore").Returns(DialogResult.Yes);
        }
 public void SetUp()
 {
     _context = new DataContext();
     _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
     _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");
     _productRepository = new Repository<Product>(_context);
     _storeRepository = new Repository<Store>(_context);
     _hasARepository = new Repository<HasA>(_context);
     _product = new Product() { ProductName = "TestProduct" };
     _store = new Store() { StoreName = "TestStore" };
 }
        public void SetUp()
        {
            _context = new DataContext();
            _unitOfWork = new UnitOfWork(_context);
            _admin = new Admin(_unitOfWork);
            _adminNewStoreModel = new AdminNewStoreModel(_admin);
            _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;";
            _context.Database.ExecuteSqlCommand("dbo.TestCleanTable");

            _secureStringTest.AppendChar('A');
            _secureStringTest.AppendChar('B');
            _secureStringTest.AppendChar('C');
        }
        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);
        }