Пример #1
0
        // DELETE: api/IDProofType/5
        public IHttpActionResult Delete(int id)
        {
            IDProofType result     = IDProofTypeList.Where(p => p.ID == id).FirstOrDefault();
            var         resultflag = IDProofTypeList.Remove(result);

            return(Ok(resultflag));
        }
Пример #2
0
        // PUT: api/IDProofType/5
        public IHttpActionResult Put(int id, IDProofType value)
        {
            IDProofType result = IDProofTypeList.Where(p => p.ID == id).FirstOrDefault();

            result = value;
            return(Ok(result));
        }
Пример #3
0
        public void PostIDProofType()
        {
            // Arrange
            IDProofTypeController controller = new IDProofTypeController();

            IDProofType IDProofTypeObj = new IDProofType
            {
                Name = "PAN"
            };
            var actResult = controller.Post(IDProofTypeObj);
            // Act
            var result = actResult as OkNegotiatedContentResult <IDProofType>;

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Content.ID > 0);
        }
Пример #4
0
        public void PutIDProofType()
        {
            // Arrange
            IDProofTypeController controller = new IDProofTypeController();

            IDProofType IDProofTypeObj = new IDProofType
            {
                ID   = 1,
                Name = "Put request sucessfull",
            };
            var actResult = controller.Put(1, IDProofTypeObj);
            // Act
            var result = actResult as OkNegotiatedContentResult <IDProofType>;

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Content.Name.Equals("Put request sucessfull"));
        }
Пример #5
0
 // POST: api/IDProofType
 public IHttpActionResult Post(IDProofType value)
 {
     IDProofTypeList.Add(value);
     value.ID = IDProofTypeList.Count;
     return(Ok(value));
 }