public void Initialize() { _batchbllMock = new Mock <IBatchBll>(); _loggerMock = new Mock <ILog>(); objController = new BatchController(_batchbllMock.Object, _loggerMock.Object); listBatches = new List <BatchModel>() { new BatchModel() { BatchId = 1, Name = "US", Quantity = 10, Variety = "Rasberry" }, new BatchModel() { BatchId = 2, Name = "US", Quantity = 10, Variety = "Rasberry2" }, new BatchModel() { BatchId = 3, Name = "US", Quantity = 10, Variety = "Rasberry3" } }; }
public void CreateBatchTest() { BatchDTO batch = createBatchDTO(); UserDTO userDTO = createUserDTO(); Guid token = Guid.NewGuid(); var mockBatchService = new Mock <BatchService>(); mockBatchService.Setup(b => b.CreateBatch(batch)).Verifiable(); var mockUserService = new Mock <UserService>(); mockUserService.Setup(us => us.GetUserLoggedIn(token)).Returns(userDTO); BatchController batchController = new BatchController(mockBatchService.Object, mockUserService.Object); batchController.Request = createBatchControllerRequest(); this.addTokenHeaderToRequest(batchController.Request, token); ResponseMessageResult response = (ResponseMessageResult)batchController.Post(batch); Assert.AreEqual(HttpStatusCode.OK, response.Response.StatusCode); }
private void save_bt_Click(object sender, EventArgs e) { try { BatchController batch = new BatchController(); StudentController stuentcontrol = new StudentController(); if (batch.saveBatch(batch_txt.Text, term_com.SelectedItem.ToString())) { stuentcontrol.saveStudent(frm_st_id_txt.Text, to_st_id_txt.Text, batch_txt.Text); MessageBox.Show("saved successfully"); } else { MessageBox.Show("Don't save try again"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void CleanUp() { _batchController.Dispose(); // assumes Disposable is implemented _batchController = null; //put other cleanup code here }
public void Setup() { _logger = Mock.Of <ILogger <BatchController> >(); _service = new BatchDataMock(); _batchController = new BatchController(_service, _logger); }
public static BatchController Fixture() { BatchController controller = new BatchController(new BatchRepository(), "", new LoginView()); return controller; }
public static BatchController Fixture() { BatchController controller = new BatchController(new BatchRepository(), "", new LoginView()); return(controller); }
private SpecificationEngine buildBatchedEngine(string tracingStyle) { IBatchObserver batchObserver = new BatchObserver(); IExecutionObserver executionObserver = new NulloObserver(); if ("TeamCity" == tracingStyle) { batchObserver = new TeamCityBatchObserver(batchObserver); executionObserver = new TeamCityExecutionObserver(); } var executionMode = new BatchExecutionMode(batchObserver); var runner = new SpecRunner(executionMode, _system, _specExpiration); var engine = new SpecificationEngine( _system, runner, executionObserver); _controller = new BatchController(engine, batchObserver); _services.Add(engine); EventAggregator.Messaging.AddListener(_controller); return engine; }
public void TestAddBatchError() { BatchController.AddBatch(null); }
public void Dispose() { controller = null; }