public void Init() { ServiceMock = new Mock <IService>(); LoggerMock = new Mock <ILogger <PropertiesController> >(); sut = new PropertiesController(ServiceMock.Object, LoggerMock.Object); }
public void GetReturnsMultipleObjects() { // Arrange List <Property> properties = new List <Property>(); properties.Add(new Property { Id = 1, Place = "Place1" }); properties.Add(new Property { Id = 2, Place = "Place2" }); var mockRepository = new Mock <IPropertyRepository>(); mockRepository.Setup(x => x.GetAll()).Returns(properties.AsEnumerable()); var controller = new PropertiesController(mockRepository.Object); // Act IEnumerable <Property> result = controller.GetAll(); // Assert Assert.IsNotNull(result); Assert.AreEqual(properties.Count, result.ToList().Count); Assert.AreEqual(properties.ElementAt(0), result.ElementAt(0)); Assert.AreEqual(properties.ElementAt(1), result.ElementAt(1)); }
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); }
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 async Task GetPropertyByIdAsync() { var portfolio1 = new Portfolio { Name = "Portfolio1" }; var property = new Property { Address = new Address { City = "Exeter", CreatedDateTime = DateTime.Now.AddDays(-3), IsActive = true, Line1 = "Line 1", Line2 = "Line 2", PostCode = "Postcode", Town = "Town" }, Description = "Description", IsActive = true, NoOfBeds = 2, PropertyValue = 12345, PurchaseDate = new DateTime(2008, 3, 1), PurchasePrice = 12343, RentalPrice = 431, CreatedDateTime = DateTime.Now.AddDays(-1), Portfolio = portfolio1, Tenants = new List <Tenant> { new Tenant { FirstName = "FirstName1", LastName = "LastName1", EmailAddress = "*****@*****.**", IsActive = true, Profession = "Window cleaner", TenancyStartDate = DateTime.Now.AddDays(-1) }, new Tenant { FirstName = "FirstName2", LastName = "LastName2", EmailAddress = "*****@*****.**", IsActive = true, Profession = "Superstar DJ", TenancyStartDate = DateTime.Now.AddDays(-1) } } }; _propertyServiceMock.Setup(s => s.GetPropertyById(It.IsAny <Guid>(), It.IsAny <Guid>())) .Returns(Task.FromResult <Property>(property)).Verifiable(); var controller = new PropertiesController(_propertyServiceMock.Object, _mapperMock); controller.ControllerContext = new ControllerContext() { HttpContext = new DefaultHttpContext() { User = _principle } }; var results = await controller.GetPropertyById(It.IsAny <Guid>(), It.IsAny <Guid>()); var okResult = results.Result as OkObjectResult; var okVal = okResult.Value as PropertyDetailDto; Assert.AreEqual((int)System.Net.HttpStatusCode.OK, okResult.StatusCode); Assert.AreEqual("Description", okVal.Description); Assert.AreEqual(2, okVal.Tenants.Count); Assert.AreEqual(2, okVal.NoOfBeds); Assert.AreEqual("Exeter", okVal.Address.City); }
[TestMethod] //[2] | Update Property public void PutPropertyUpdatesProperty() { //Arrange var propertiesController = new PropertiesController(); var newProp = new PropertyModel { Name = "Wonder Mansion", Address1 = "122 Wonka Way", Address2 = "", City = "Golden Coast", Zip = "23123", State = "CA" }; //The result of the PostRequest IHttpActionResult result = propertiesController.PostProperty(newProp); //Cast result as the content result so I can gather information from Content Result CreatedAtRouteNegotiatedContentResult <PropertyModel> contentResult = (CreatedAtRouteNegotiatedContentResult <PropertyModel>)result; //REsult containts 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.PutProperty(propertyResult.Content.PropertyId, newProp); //Assert Assert.IsInstanceOfType(result, typeof(StatusCodeResult)); }
[TestMethod] //[3] | Create Property public void PostPropertyCreatesProperty() { //Arrange var propertiesController = new PropertiesController(); //act var newProp = new PropertyModel { Name = "Wonder Mansion", Address1 = "122 Wonka Way", Address2 = "", City = "Golden Coast", Zip = "23123", State = "CA" }; //Result of the Post Request IHttpActionResult result = propertiesController.PostProperty(newProp); //Assert Assert.IsInstanceOfType(result, typeof(CreatedAtRouteNegotiatedContentResult <PropertyModel>)); //Cast CreatedAtRouteNegotiatedContentResult <PropertyModel> contentResult = (CreatedAtRouteNegotiatedContentResult <PropertyModel>)result; Assert.IsTrue(contentResult.Content.PropertyId != 0); }
public void Setup() { InitialiseMapping(); _connection = new SqliteConnection("DataSource=:memory:"); _connection.Open(); var options = new DbContextOptionsBuilder <PropertyContext>() .UseSqlite(_connection) .Options; var inMemoryContext = new PropertyContext(options); inMemoryContext.Properties.AddRange(GenerateFakeProperties()); inMemoryContext.SaveChanges(); // While working with a inMemoryDb there is no need for mocking IPropertyRepository // Instead working to implementation provides implementation test without affecting Db // var service = new Mock<IPropertyRepository>(); // service.Setup(p => p.GetProperties()).Returns(inMemoryContext.Properties); var service = new PropertyRepository(inMemoryContext); Sut = new PropertiesController(service); }
private void PropertySave() { PropertiesController pc = new PropertiesController(); PropertiesInfo pi = new PropertiesInfo(); pi.PropertyId = -1; pi.PortalId = PortalId; pi = (PropertiesInfo)(Utilities.ConvertFromHashTableToObject(Params, pi)); pi.Name = Utilities.CleanName(pi.Name); if (!(string.IsNullOrEmpty(pi.ValidationExpression))) { pi.ValidationExpression = HttpUtility.UrlDecode(HttpUtility.HtmlDecode(pi.ValidationExpression)); } if (pi.PropertyId == -1) { string lbl = Params["Label"].ToString(); LocalizationUtils lcUtils = new LocalizationUtils(); lcUtils.SaveResource("[RESX:" + pi.Name + "].Text", lbl, PortalId); } else { if (Utilities.GetSharedResource("[RESX:" + pi.Name + "]").ToLowerInvariant().Trim() != Params["Label"].ToString().ToLowerInvariant().Trim()) { LocalizationUtils lcUtils = new LocalizationUtils(); lcUtils.SaveResource("[RESX:" + pi.Name + "].Text", Params["Label"].ToString(), PortalId); } } pc.SaveProperty(pi); ForumController fc = new ForumController(); Forum fi = fc.GetForum(PortalId, ModuleId, pi.ObjectOwnerId, true); fi.HasProperties = true; fc.Forums_Save(PortalId, fi, false, false); }
public void InitializeTests() { this.dbContext = MockDbContext.GetContext(); this.mapper = MockAutoMapper.GetAutoMapper(); this.propertyService = new PropertyService(dbContext, mapper); this.mockedConfig = new Mock <IConfiguration>(); this.propertiesController = new PropertiesController(propertyService, mapper); }
// Generate the properties for the persian turbine void GenerateProperties() { controller = GetComponent <PropertiesController>(); // Wall wallProperty = new BoolProperty(wallPropertyName, wallIsOn, GetType().GetMethod("WallPower"), GetType().GetMethod("CreateWall"), GetType().GetMethod("WallCost"), null, this); controller.specificProperties.boolProperty.Add(wallProperty); }
public void Initialize() { var options = new DbContextOptionsBuilder<PMContext>() .UseInMemoryDatabase(databaseName: "PM-Demo-UnitTest") .Options; _context = new PMContext(options); _controller = new PropertiesController(_context); }
public void GetPropertyTest() { using (var controller = new PropertiesController()) { var httpResult = controller.GetProperty(1) as OkNegotiatedContentResult <PropertyModel>; Assert.IsNull(httpResult); } }
public async Task PostPropertyTestAsync() { var portfolio3 = new Portfolio { Name = "Portfolio3" }; var property = new Property { Address = new Address { City = "Torquay", CreatedDateTime = DateTime.Now.AddDays(-3), IsActive = true, Line1 = "Line 1", Line2 = "Line 2", PostCode = "Postcode", Town = "Town" }, Description = "Description", IsActive = true, NoOfBeds = 2, PropertyValue = 12345, PurchaseDate = new DateTime(2008, 3, 1), PurchasePrice = 12343, RentalPrice = 431, CreatedDateTime = DateTime.Now.AddDays(-1), Portfolio = portfolio3, Tenants = new List <Tenant> { new Tenant { FirstName = "Jeff", LastName = "LastName1", EmailAddress = "*****@*****.**", IsActive = true, Profession = "Window cleaner", TenancyStartDate = DateTime.Now.AddDays(-1) }, new Tenant { FirstName = "Mandy", LastName = "LastName2", EmailAddress = "*****@*****.**", IsActive = true, Profession = "Superstar DJ", TenancyStartDate = DateTime.Now.AddDays(-1) } } }; _propertyServiceMock.Setup(s => s.CreateProperty(property, It.IsAny <Guid>())) .Returns(Task.FromResult <Property>(property)).Verifiable(); var controller = new PropertiesController(_propertyServiceMock.Object, _mapperMock); controller.ControllerContext = new ControllerContext() { HttpContext = new DefaultHttpContext() { User = _principle } }; var createProperty = _mapperMock.Map <PropertyCreateDto>(property); var results = await controller.CreateProperty(It.IsAny <Guid>(), createProperty); var okResult = results.Result as CreatedAtActionResult; Assert.AreEqual((int)System.Net.HttpStatusCode.Created, okResult.StatusCode); }
public void InitializeTests() { this.dbContext = MockDbContext.GetContext(); this.mapper = MockAutoMapper.GetAutoMapper(); this.propertyService = new PropertyService(dbContext, mapper); this.userManager = this.TestUserManager <User>(); this.userService = new UserService(dbContext, mapper, userManager); this.mockedConfig = new Mock <IConfiguration>(); this.propertiesController = new PropertiesController(propertyService, userService, mapper, userManager, mockedConfig.Object); }
public void PutPropertyUpdatesProperty() { int propertyIdForTest = 1; string propertyNameForTest = "Lofts"; string address1ForTest = "234 Smith Street"; //Arrange: Instantiate PropertiesController so its methods can be called var propertyController = new PropertiesController(); //Act: // Get an existing property, change it, and // pass it to PutProperty IHttpActionResult result = propertyController.GetProperty(propertyIdForTest); OkNegotiatedContentResult <PropertyModel> contentResult = (OkNegotiatedContentResult <PropertyModel>)result; PropertyModel updatedProperty = (PropertyModel)contentResult.Content; string propertyNameBeforeUpdate = updatedProperty.Name; string propertyAddress1BeforeUpdate = updatedProperty.Address1; updatedProperty.Name = propertyNameForTest; updatedProperty.Address1 = address1ForTest; result = propertyController.PutProperty (updatedProperty.PropertyId, updatedProperty); //Assert: // Verify that HTTP status code is OK // Get the property and verify that it was updated var statusCode = (StatusCodeResult)result; Assert.IsTrue(statusCode.StatusCode == System.Net.HttpStatusCode.NoContent); result = propertyController.GetProperty(propertyIdForTest); Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult <PropertyModel>)); OkNegotiatedContentResult <PropertyModel> readContentResult = (OkNegotiatedContentResult <PropertyModel>)result; updatedProperty = (PropertyModel)readContentResult.Content; Assert.IsTrue(updatedProperty.Name == propertyNameForTest); Assert.IsTrue(updatedProperty.Address1 == address1ForTest); updatedProperty.Name = propertyNameBeforeUpdate; updatedProperty.Address1 = propertyAddress1BeforeUpdate; result = propertyController.PutProperty (updatedProperty.PropertyId, updatedProperty); }
public void ConstructorShouldRegisterAllDependencies() { // Arrange var apiResult = new Mock <IApiResult>().Object; // Act var result = new PropertiesController(apiResult); // Assert result.Should().NotBeNull(); }
public void GetPropertiesReturnsProperties() { //Arrange: Instantiate PropertiesController so its methods can be called using (var propertyController = new PropertiesController()) { //Act: Call the GetProperties method IEnumerable <PropertyModel> properties = propertyController.GetProperties(); //Assert: Verify that an array was returned with at least one element Assert.IsTrue(properties.Count() > 0); } }
public void DeleteReturnsNotFound() { // Arrange var mockRepository = new Mock <IPropertyRepository>(); var controller = new PropertiesController(mockRepository.Object); // Act IHttpActionResult actionResult = controller.Delete(10); // Assert Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult)); }
public void Mock_IndexContainsModelData_List() // Confirms model as list of properties { // Arrange DbSetup(); ViewResult indexView = new PropertiesController(mock.Object).Index() as ViewResult; // Act var result = indexView.ViewData.Model; // Assert Assert.IsInstanceOfType(result, typeof(List <Property>)); }
public void Mock_GetViewResultIndex_ActionResult() // Confirms route returns view { //Arrange DbSetup(); PropertiesController controller = new PropertiesController(mock.Object); //Act var result = controller.Index(); //Assert Assert.IsInstanceOfType(result, typeof(ActionResult)); }
[TestMethod] // [0] | Get Properties public void GetPropertiesReturnProperties() { //Arrange //Properties Go Here var PropertiesController = new PropertiesController(); //Act //Call the mthod in question that needs to be tested IEnumerable <PropertyModel> property = PropertiesController.GetProperties(); //Assert Assert.IsTrue(property.Count() > 0); }
public void SetUp() { _listAlertsUseCaseMock = new Mock <IListAlertsUseCase>(); _getPropertyUseCaseMock = new Mock <IGetPropertyUseCase>(); _housingSearchUseCaseMock = new Mock <IHousingSearchUseCase>(); _listPropertiesUseCaseMock = new Mock <IListPropertiesUseCase>(); _classUnderTest = new PropertiesController( _listAlertsUseCaseMock.Object, _getPropertyUseCaseMock.Object, _housingSearchUseCaseMock.Object, _listPropertiesUseCaseMock.Object, new NullLogger <PropertiesController>()); }
private string PropertyList() { StringBuilder sb = new StringBuilder(); PropertiesController pc = new PropertiesController(); if (!(string.IsNullOrEmpty(Params["ObjectOwnerId"].ToString()))) { return(pc.ListPropertiesJSON(PortalId, Convert.ToInt32(Params["ObjectType"]), Convert.ToInt32(Params["ObjectOwnerId"]))); } else { return(string.Empty); } }
public void PutReturnsBadRequest() { // Arrange var mockRepository = new Mock <IPropertyRepository>(); var controller = new PropertiesController(mockRepository.Object); // Act IHttpActionResult actionResult = controller.Put(10, new Property { Id = 9, Place = "Place2" }); // Assert Assert.IsInstanceOfType(actionResult, typeof(BadRequestResult)); }
[TestMethod] //[1] | Get Property from ID public void GetPropertyFromIdReturnProperty() { //Arrange var PropertiesController = new PropertiesController(); //Act IHttpActionResult result = PropertiesController.GetProperty(1); //Assert //If action returns: NotFound() Assert.IsNotInstanceOfType(result, typeof(NotFoundResult)); //if Acction returns: Ok(); Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult <PropertyModel>)); }
public void DB_CreatesNewProperties_Collection() { // Arrange PropertiesController controller = new PropertiesController(db); Property testProperty = new Property(); testProperty.Name = "TestDb Property"; testProperty.Cost = 400; testProperty.Description = "Big"; // Act controller.Create(testProperty); var collection = (controller.Index() as ViewResult).ViewData.Model as List <Property>; // Assert CollectionAssert.Contains(collection, testProperty); }
public void GetRepositoriesReturnsEmptyListIfDbEmpty() { // Arrange var service = new Mock <IPropertyRepository>(); service.Setup(m => m.GetProperties()).Returns(new List <Property>()); var sut = new PropertiesController(service.Object); // Act var result = sut.GetProperties() as OkObjectResult; // Assert Assert.That(result.StatusCode, Is.EqualTo(200)); Assert.That(result.Value, Is.TypeOf <List <PropertyDto> >()); Assert.That(result.Value, Is.Empty); }
internal void PropertyDelete() { PropertiesController pc = new PropertiesController(); PropertiesInfo prop = pc.GetProperty(Convert.ToInt32(Params["propertyid"]), PortalId); if (prop != null) { pc.DeleteProperty(PortalId, Convert.ToInt32(Params["propertyid"])); if (!(pc.ListProperties(PortalId, prop.ObjectType, prop.ObjectOwnerId).Count > 0)) { ForumController fc = new ForumController(); Forum fi = fc.GetForum(PortalId, ModuleId, prop.ObjectOwnerId, true); fi.HasProperties = false; fc.Forums_Save(PortalId, fi, false, false); } } }
public void Setup() { FakePropertyId = Guid.Parse("8cc32b40-578d-47c1-bb9f-63240737243f"); FakeNotFoundPropertyId = Guid.Parse("00000000-0000-0000-0000-000000000000"); FakeExistPropertyId = Guid.Parse("b5b1a0c6-efc7-43b4-91b1-024a0268a7cf"); FakeProperty = GetPropertyFake(FakePropertyId); FakeNotFoundProperty = GetPropertyFake(FakeNotFoundPropertyId); FakeExistProperty = GetPropertyFake(FakeExistPropertyId); _propertyRepositoryMock.Setup(x => x.GetProperty(It.Is <Guid>(x => x == FakePropertyId))) .Returns(Task.FromResult(FakeProperty)); _propertyRepositoryMock.Setup(x => x.GetProperty(It.Is <Guid>(x => x == FakeExistPropertyId))) .Returns(Task.FromResult(FakeExistProperty)); _propertyRepositoryMock.Setup(x => x.GetProperties(It.IsAny <PropertiesParameters>())) .Returns(Task.FromResult(new List <Property>() { FakeProperty })); _propertyRepositoryMock.Setup(x => x.CreateProperty(It.Is <Property>(x => x.IdProperty == FakePropertyId))) .Returns(Task.FromResult(FakeProperty)); _propertyRepositoryMock.Setup(x => x.UpdateProperty(It.Is <Property>(x => x.IdProperty == FakePropertyId))) .Returns(Task.FromResult(FakeProperty)); _propertyRepositoryMock.Setup(x => x.DeleteProperty(It.Is <Property>(x => x.IdProperty == FakePropertyId))) .Returns(Task.FromResult(true)); Property nullObj = null; _propertyRepositoryMock.Setup(x => x.GetProperty(It.Is <Guid>(x => x == FakeNotFoundPropertyId))) .Returns(Task.FromResult(nullObj)); _propertyRepositoryMock.Setup(x => x.PropertyExists(It.Is <Guid>(x => x == FakeNotFoundPropertyId))) .Returns(false); _propertyRepositoryMock.Setup(x => x.PropertyExists(It.Is <Guid>(x => x == FakeExistPropertyId))) .Returns(true); _propertyRepositoryMock.Setup(x => x.CreateProperty(It.Is <Property>(x => x.IdProperty == FakeExistPropertyId))) .Throws(new DbUpdateException()); _propertyRepositoryMock.Setup(x => x.UpdateProperty(It.Is <Property>(x => x.IdProperty == FakeNotFoundPropertyId))) .Throws(new DbUpdateConcurrencyException()); _propertyRepositoryMock.Setup(x => x.DeleteProperty(It.Is <Property>(x => x.IdProperty == FakeExistPropertyId))) .Returns(Task.FromResult(false)); PropertyController = new PropertiesController( _loggerMock.Object, _propertyRepositoryMock.Object ); }
internal void PropertyDelete() { PropertiesController pc = new PropertiesController(); PropertiesInfo prop = pc.GetProperty(Convert.ToInt32(Params["propertyid"]), PortalId); if (prop != null) { pc.DeleteProperty(PortalId, Convert.ToInt32(Params["propertyid"])); if (! (pc.ListProperties(PortalId, prop.ObjectType, prop.ObjectOwnerId).Count > 0)) { ForumController fc = new ForumController(); Forum fi = fc.GetForum(PortalId, ModuleId, prop.ObjectOwnerId, true); fi.HasProperties = false; fc.Forums_Save(PortalId, fi, false, false); } } }
private void UpdateSort() { int propertyId = -1; int sortOrder = -1; PropertiesController pc = new PropertiesController(); string props = Params["props"].ToString(); props = props.Remove(props.LastIndexOf("^")); foreach (string s in props.Split('^')) { if (! (string.IsNullOrEmpty(props))) { propertyId = Convert.ToInt32(s.Split('|')[0]); sortOrder = Convert.ToInt32(s.Split('|')[1]); PropertiesInfo pi = pc.GetProperty(propertyId, PortalId); if (pi != null) { pi.SortOrder = sortOrder; pc.SaveProperty(pi); } } } }
private string PropertyList() { StringBuilder sb = new StringBuilder(); PropertiesController pc = new PropertiesController(); if (! (string.IsNullOrEmpty(Params["ObjectOwnerId"].ToString()))) { return pc.ListPropertiesJSON(PortalId, Convert.ToInt32(Params["ObjectType"]), Convert.ToInt32(Params["ObjectOwnerId"])); } else { return string.Empty; } }
private void PropertySave() { PropertiesController pc = new PropertiesController(); PropertiesInfo pi = new PropertiesInfo(); pi.PropertyId = -1; pi.PortalId = PortalId; pi = (PropertiesInfo)(Utilities.ConvertFromHashTableToObject(Params, pi)); pi.Name = Utilities.CleanName(pi.Name); if (! (string.IsNullOrEmpty(pi.ValidationExpression))) { pi.ValidationExpression = HttpUtility.UrlDecode(HttpUtility.HtmlDecode(pi.ValidationExpression)); } if (pi.PropertyId == -1) { string lbl = Params["Label"].ToString(); LocalizationUtils lcUtils = new LocalizationUtils(); lcUtils.SaveResource("[RESX:" + pi.Name + "].Text", lbl, PortalId); } else { if (Utilities.GetSharedResource("[RESX:" + pi.Name + "]").ToLowerInvariant().Trim() != Params["Label"].ToString().ToLowerInvariant().Trim()) { LocalizationUtils lcUtils = new LocalizationUtils(); lcUtils.SaveResource("[RESX:" + pi.Name + "].Text", Params["Label"].ToString(), PortalId); } } pc.SaveProperty(pi); ForumController fc = new ForumController(); Forum fi = fc.GetForum(PortalId, ModuleId, pi.ObjectOwnerId, true); fi.HasProperties = true; fc.Forums_Save(PortalId, fi, false, false); }