コード例 #1
0
        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);
        }
コード例 #2
0
 public void SetUp()
 {
     _storemanager = Substitute.For<IStoremanager>();
     _autocomplete = Substitute.For<IAutocomplete>();
     _msgBox = Substitute.For<ICreateMsgBox>();
     _uut = new ChangePriceModel(_storemanager, _autocomplete, _msgBox);
     _productAndPrice.Name = "Banan";
     _productAndPrice.Price = 12;
 }