コード例 #1
0
        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();
        }
コード例 #2
0
        public void SetUp()
        {
            _autocomplete = Substitute.For<IAutocomplete>();
            _storemanager = Substitute.For<IStoremanager>();
            _msgBox = Substitute.For<ICreateMsgBox>();

            _uut = new NewProductModel(_storemanager, _autocomplete, _msgBox);
            _product.ProductName = "Banan";
            _product.ProductId = 12;
            _productAndPrice.Name = "Banan";
            _productAndPrice.Price = 12;
        }