コード例 #1
0
        //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();
        }
コード例 #2
0
        //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();
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 //for update particular epic based on project id
 public void Update(int id, EpicMaster res)
 {
     _repository.Update(id, res);
 }
コード例 #9
0
 //for adding new item into the product EpicDb table
 public void Add(EpicMaster bklog)
 {
     _context.EpicDb.Add(bklog);
     _context.SaveChanges();
 }
コード例 #10
0
 //for adding new epic
 public void Add(EpicMaster backlog)
 {
     _repository.Add(backlog);
 }
コード例 #11
0
 //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"));
 }
コード例 #12
0
 //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"));
 }
コード例 #13
0
 public void put(int id, [FromBody] EpicMaster value)
 {
     _service.Update(id, value);
 }
コード例 #14
0
 public void Post([FromBody] EpicMaster backlog)
 {
     _service.Add(backlog);
 }