//for updating a particular epic based on epic id. public void Update(int id, EpicMaster bklog) { EpicMaster data = _context.EpicDb.FirstOrDefault(m => m.EpicId == id); data.Description = bklog.Description; //persisting the changes made to the database _context.SaveChanges(); }
//for deleting particular epic based on epic id public void Delete(int id) { //selecting the Epics from the EpicDb Table by EpicId passed by the client EpicMaster backlogToBeRemoved = _context.EpicDb.FirstOrDefault(m => m.EpicId == id); //Removing the Epic object _context.EpicDb.Remove(backlogToBeRemoved); //persisting the changes made to the database _context.SaveChanges(); }
public void Epic_service_setConnection_method_should_throw_Format_Exception_with_invalid_input() { EpicMaster backlog = new EpicMaster(); backlog.EpicId = 1; var mockrepo = new Mock <IEpicRepository>(); mockrepo.Setup(x => x.SetConnectId(It.IsAny <int>(), It.IsAny <string>())).Throws(new FormatException()); EpicService obj = new EpicService(mockrepo.Object); var exception = Record.Exception(() => obj.SetConnectId(It.IsAny <int>(), It.IsAny <string>())); Assert.IsType <FormatException>(exception); }
public void Epic_Service_Add_Method_should_throw_FormatException_with_invalid_input() { //Arrange var request = new EpicMaster(); request.EpicId = 1; var mockRepoReq = new Mock <IEpicRepository>(); //mocking RequestRepository mockRepoReq.Setup(x => x.Add(request)).Throws(new FormatException()); //mocking GetAll() of RequestRepository EpicService obj = new EpicService(mockRepoReq.Object); //Act var ex = Record.Exception(() => obj.Add(request)); //Assert // Assert.NotNull(res); Assert.IsType <FormatException>(ex); }
public void Epic_Service_Add_Method_should_throw_nullRefrenceException() { //Arrange var request = new EpicMaster(); request.EpicId = 1; var mockRepoReq = new Mock <IEpicRepository>(); //mocking RequestRepository mockRepoReq.Setup(x => x.Add(request)).Throws(new NullReferenceException()); //mocking GetAll() of RequestRepository EpicService obj = new EpicService(mockRepoReq.Object); //Act var ex = Record.Exception(() => obj.Add(request)); //Assert ; Assert.IsType <NullReferenceException>(ex); }
public void Epic_Service_GetAll_Method_should_return_productbacklog_type_object() { //Arrange List <EpicMaster> requests = new List <EpicMaster>(); var request = new EpicMaster(); request.EpicId = 1; requests.Add(request); var mockRepoReq = new Mock <IEpicRepository>(); //mocking RequestRepository mockRepoReq.Setup(x => x.GetAll(1)).Returns(requests); //mocking GetAll() of RequestRepository EpicService obj = new EpicService(mockRepoReq.Object); //Act var res = obj.GetAll(1); //Assert Assert.IsType <List <EpicMaster> >(res); }
public void Epic_Service_GetAll_Method_To_GetAll_Epics() { //Arrange List <EpicMaster> requests = new List <EpicMaster>(); var request = new EpicMaster(); request.EpicId = 1; requests.Add(request); var mockRepoReq = new Mock <IEpicRepository>(); //mocking RequestRepository mockRepoReq.Setup(x => x.GetAll(1)).Returns(requests); //mocking GetAll() of RequestRepository EpicService obj = new EpicService(mockRepoReq.Object); //Act var res = obj.GetAll(1); //Assert Assert.NotNull(res); Assert.Equal(requests, res); }
//for update particular epic based on project id public void Update(int id, EpicMaster res) { _repository.Update(id, res); }
//for adding new item into the product EpicDb table public void Add(EpicMaster bklog) { _context.EpicDb.Add(bklog); _context.SaveChanges(); }
//for adding new epic public void Add(EpicMaster backlog) { _repository.Add(backlog); }
//this method is to update a particular epic based on epicid public Task put(int id, EpicMaster value) { _service.Update(id, value); return(Clients.Client(Context.ConnectionId).InvokeAsync("whenUpdated")); }
//this method is to add new epic based on prject id public Task Post(EpicMaster backlog) { _service.Add(backlog); return(Clients.Client(Context.ConnectionId).InvokeAsync("whenAdded")); }
public void put(int id, [FromBody] EpicMaster value) { _service.Update(id, value); }
public void Post([FromBody] EpicMaster backlog) { _service.Add(backlog); }