public void Setup() { options = new DbContextOptionsBuilder <AppDbContext>() .UseInMemoryDatabase(databaseName: "Add_writes_to_database").Options; context = new AppDbContext(options); controller = new GoodController(context); }
public async Task Get_Returns_AFreshCake() { // Control over expected cake // Ignore internal logic/dependencies of any ICakeFactory Implementation var expectedCake = new Cake { Style = CakeStyle.ChocolateFudge, IsFresh = true }; var cakeMock = Substitute.For <ICakeFactory>(); cakeMock .Bake(0) .ReturnsForAnyArgs(expectedCake); var sut = new GoodController(cakeMock); var result = await sut.Get(); var okObjectResult = result as OkObjectResult; Assert.NotNull(okObjectResult); var cake = okObjectResult.Value as Cake; Assert.NotNull(cake); Assert.True(cake.IsFresh); }
public AddGoodForm(GoodController controller) { this._controller = controller; InitializeComponent(); this.btnAddGood.Click += this._controller.AddFromForm; }
public TripsModel(IStorage storage) { _trips = new TripController(storage); _photos = new PhotoController(storage); _places = new PlaceController(storage); _goals = new GoalController(storage); _goods = new GoodController(storage); _purchases = new PurchaseController(storage); }
public void SelfInit() { if (this._db == null) { this._db = new MyDatabase(new Config(Environment.CurrentDirectory)); } this.SupplierDataController = new SupplierController(this, this._db); this.GoodDataController = new GoodController(this, this._db); this.CategoryDataController = new CategoryController(this, this._db); this._initialized = true; }
private void _initForms() { this._supplierController = new SupplierController(); this._categoryController = new CategoryController(); this._goodController = new GoodController(); this.MainForm = new MainForm(this); this.FirstSettingsForm = new FirstSettingsForm(this); this._supplierController.MainForm = this.MainForm; this._categoryController.MainForm = this.MainForm; this._goodController.MainForm = this.MainForm; }