public void CanHandle_StringType_ReturnsTrue() { //Assign var mapper = new UmbracoPropertyBooleanMapper(); var config = new UmbracoPropertyConfiguration(); config.PropertyInfo = new FakePropertyInfo(typeof(bool)); //Act var result = mapper.CanHandle(config, null); //Assert Assert.IsTrue(result); }
public void SetProperty_PropertyString_ValueWrittenToProperty() { //Assign var expected = true; var content = _contentService.GetById(new Guid("{5928EFBB-6DF2-4BB6-A026-BF4938D7ED7A}")); var property = content.Properties[ContentTypeProperty]; var mapper = new UmbracoPropertyBooleanMapper(); var config = new UmbracoPropertyConfiguration(); //Act mapper.SetProperty(property, expected, config, null); //Assert Assert.AreEqual(expected, property.Value); }
public void GetProperty_PropertyContainsData_BooleanIsReturned() { //Assign var fieldValue = true; var content = _contentService.GetById(new Guid("{5928EFBB-6DF2-4BB6-A026-BF4938D7ED7A}")); var property = content.Properties[ContentTypeProperty]; property.Value = fieldValue; var mapper = new UmbracoPropertyBooleanMapper(); var config = new UmbracoPropertyConfiguration(); //Act var result = (bool)mapper.GetProperty(property, config, null); //Assert Assert.AreEqual(fieldValue, result); }