public async Task Put()
        {
            //Arrange
            var get = await controller.Get(1);

            var okgetResult = Assert.IsType <OkObjectResult>(get);
            var entity      = Assert.IsType <network_name>(okgetResult.Value);


            var newEntity = new network_name();

            newEntity.name = "not Defined";
            //should test the equals Equatable for all these too
            var huh = entity.Equals(newEntity);

            entity.name = "testEdit";
            //Act
            var response = await controller.Put(1, entity);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var result   = Assert.IsType <network_name>(okResult.Value);

            Assert.Equal(entity.name, result.name);
        }
 public async Task <IActionResult> Put(int id, [FromBody] network_name entity)
 {
     try
     {
         if (id < 0 || !isValid(entity))
         {
             return(new BadRequestResult());
         }
         return(Ok(await agent.Update <network_name>(id, entity)));
     }
     catch (Exception ex)
     {
         return(await HandleExceptionAsync(ex));
     }
 }
 public async Task <IActionResult> Post([FromBody] network_name entity)
 {
     try
     {
         if (!isValid(entity))
         {
             return(new BadRequestResult());
         }
         //sm(agent.Messages);
         return(Ok(await agent.Add <network_name>(entity)));
     }
     catch (Exception ex)
     {
         //sm(agent.Messages);
         return(await HandleExceptionAsync(ex));
     }
 }
        public async Task Post()
        {
            //Arrange
            var entity = new network_name()
            {
                name = "TestPost"
            };


            //Act
            var response = await controller.Post(entity);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var result   = Assert.IsType <network_name>(okResult.Value);


            Assert.Equal("TestPost", result.name);
        }