public void DeletePropertyDeletesProperty()
        {
            //Arrange:
            // Instantiate PropertiesController so its methods can be called
            // Create a new property to be deleted, and get its property ID

            var propertyController = new PropertiesController();

            var property = new PropertyModel
            {
                Name = "Office Space",
                Address1 = "101 Broadway",
                City = "San Francisco",
                State = "CA"
            };
            IHttpActionResult propertyResult = propertyController.PostProperty(property);
            CreatedAtRouteNegotiatedContentResult<PropertyModel> contentResult =
                (CreatedAtRouteNegotiatedContentResult<PropertyModel>)propertyResult;

            int propertyIdToDelete = contentResult.Content.PropertyId;

            // Add a lease corresponding to the property
            int createdLeaseId;
            using (var leaseController = new LeasesController())
            {
                var lease = new LeaseModel
                {
                    CreatedDate = new DateTime(2014, 9, 30),
                    PropertyId = propertyIdToDelete,
                    TenantId = 1,
                    StartDate = new DateTime(2015, 1, 30),
                    Rent = 800,
                    LeaseType = Constants.RentPeriod.Monthly
                };
                IHttpActionResult leaseResult = leaseController.PostLease(lease);
                CreatedAtRouteNegotiatedContentResult<LeaseModel> leaseContentResult =
                    (CreatedAtRouteNegotiatedContentResult<LeaseModel>)leaseResult;

                createdLeaseId = leaseContentResult.Content.LeaseId;
            }

            //Act: Call DeleteProperty
            propertyResult = propertyController.DeleteProperty(propertyIdToDelete);

            //Assert:
            // Verify that HTTP result is OK
            // Verify that reading deleted property returns result not found
            Assert.IsInstanceOfType(propertyResult, typeof(OkNegotiatedContentResult<PropertyModel>));

            propertyResult = propertyController.GetProperty(propertyIdToDelete);
            Assert.IsInstanceOfType(propertyResult, typeof(NotFoundResult));

            // Verify that the lease created above was deleted
            using (var leaseController = new LeasesController())
            {
                IHttpActionResult leaseResult = leaseController.GetLease(createdLeaseId);
                Assert.IsInstanceOfType(leaseResult, typeof(NotFoundResult));
            }
        }
        public void PostPropertyCreatesProperty()
        {
            //Arrange: Instantiate PropertiesController so its methods can be called
            var propertyController = new PropertiesController();

            //Act:
            // Create a PropertyModel object populated with test data,
            //  and call PostProperty
            var newProperty = new PropertyModel
            {
                Name="Huge Penthouse",
                Address1="Some address",
                City="New York",
                State="NY"
            };
            IHttpActionResult result = propertyController.PostProperty(newProperty);

            //Assert:
            // Verify that the HTTP result is CreatedAtRouteNegotiatedContentResult
            // Verify that the HTTP result body contains a nonzero property ID
            Assert.IsInstanceOfType
                (result, typeof(CreatedAtRouteNegotiatedContentResult<PropertyModel>));
            CreatedAtRouteNegotiatedContentResult<PropertyModel> contentResult =
                (CreatedAtRouteNegotiatedContentResult<PropertyModel>)result;
            Assert.IsTrue(contentResult.Content.PropertyId != 0);

            // Delete the test property
            result = propertyController.DeleteProperty(contentResult.Content.PropertyId);
        }
        [TestMethod] // [4] | Delete Property
        public void DeletePropertyDeleteProperty()
        {
            //Arrange
            var propertiesController = new PropertiesController();

            //act 
            var dbProp = new PropertyModel
            {
                Name = "Wonder Mansion",
                Address1 = "122 Wonka Way",
                Address2 = "",
                City = "Golden Coast",
                Zip = "23123",
                State = "CA"
            };

            //Add 'new property to database using post' 
            //Save returned value as RESULT
            IHttpActionResult result = propertiesController.PostProperty(dbProp);

            //Cast result as Content Result so I can gathere information from the content result
            CreatedAtRouteNegotiatedContentResult<PropertyModel> contentResult = (CreatedAtRouteNegotiatedContentResult<PropertyModel>)result;

            //Result contains the property I had just created
            result = propertiesController.GetProperty(contentResult.Content.PropertyId);

            //Get PropertyModel from result
            OkNegotiatedContentResult<PropertyModel> propertyResult = (OkNegotiatedContentResult<PropertyModel>)result;

            //Act
            result = propertiesController.DeleteProperty(contentResult.Content.PropertyId);

            //Assert

            //If action returns not found
            Assert.IsNotInstanceOfType(result, typeof(NotFoundResult));

            //If action retruns OK()
            Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<PropertyModel>));



        }