[TestMethod] // [2] Update Tenant
        public void PutTenantUpdatesTenant()
        {
           
           
            //Arrange
            var tCtrl = new TenantsController();

            var newTenant = new TenantModel
            {
                FirstName = "Test",
                LastName = "LastNameTest",
                Telephone = "12223334444",
                EmailAddress = "*****@*****.**"
            };

            //The result of the Post Request
            IHttpActionResult result = tCtrl.PostTenant(newTenant);

            //Cast result of the content result so that I can gether information form the Contente
            CreatedAtRouteNegotiatedContentResult<TenantModel> contentResult = (CreatedAtRouteNegotiatedContentResult<TenantModel>)result;

            //Result containts the tenant I have just created
            result = tCtrl.GetTenant(contentResult.Content.TenantId);

            //Get tenant model from result
            OkNegotiatedContentResult<TenantModel> tenantResult = (OkNegotiatedContentResult<TenantModel>)result;

            //Act
            result = tCtrl.PutTenant(tenantResult.Content.TenantId, newTenant);

            //Assert
            Assert.IsInstanceOfType(result, typeof(StatusCodeResult));
        }
        public void PutTenantUpdatesTenant()
        {
            int tenantIdForTest = 1;
            string tenantFirstNameForTest = "Testy";
            string tenantLastNameForTest = "Testerson";

            //Arrange: Instantiate TenantsController so its methods can be called
            var tenantController = new TenantsController();

            //Act:
            // Get an existing tenant, change it, and
            //  pass it to PutTenant

            IHttpActionResult result = tenantController.GetTenant(tenantIdForTest);
            OkNegotiatedContentResult<TenantModel> contentResult =
                (OkNegotiatedContentResult<TenantModel>)result;
            TenantModel updatedTenant = (TenantModel)contentResult.Content;

            string tenantFirstNameBeforeUpdate = updatedTenant.FirstName;
            string tenantLastNameBeforeUpdate = updatedTenant.LastName;

            updatedTenant.FirstName = tenantFirstNameForTest;
            updatedTenant.LastName = tenantLastNameForTest;

            result = tenantController.PutTenant
                                     (updatedTenant.TenantId, updatedTenant);

            //Assert:
            // Verify that HTTP status code is OK
            // Get the tenant and verify that it was updated

            var statusCode = (StatusCodeResult)result;

            Assert.IsTrue(statusCode.StatusCode == System.Net.HttpStatusCode.NoContent);

            result = tenantController.GetTenant(tenantIdForTest);

            Assert.IsInstanceOfType(result,
                typeof(OkNegotiatedContentResult<TenantModel>));

            OkNegotiatedContentResult<TenantModel> readContentResult =
                (OkNegotiatedContentResult<TenantModel>)result;
            updatedTenant = (TenantModel)readContentResult.Content;

            Assert.IsTrue(updatedTenant.FirstName == tenantFirstNameForTest);
            Assert.IsTrue(updatedTenant.LastName == tenantLastNameForTest);

            updatedTenant.FirstName = tenantFirstNameBeforeUpdate;
            updatedTenant.LastName = tenantLastNameBeforeUpdate;

            result = tenantController.PutTenant
                                 (updatedTenant.TenantId, updatedTenant);
        }