public void ReadOnly_ReturnsTrue() { //Assign var mapper = new UmbracoParentMapper(); //Act var result = mapper.ReadOnly; //Assert Assert.IsTrue(result); }
public void MapToProperty_ConfigurationSetupCorrectly_CallsCreateClassOnService() { //Assign var contentService = new ContentService(_unitOfWork, _repoFactory); var content = contentService.GetById(new Guid("{C382AE57-D325-4357-A32A-0A959BBD4101}")); var service = Substitute.For<IUmbracoService>(); service.ContentService.Returns(contentService); var context = new UmbracoDataMappingContext(null, content, service); var config = new UmbracoParentConfiguration(); config.PropertyInfo = typeof(Stub).GetProperty("Property"); var mapper = new UmbracoParentMapper(); mapper.Setup(new DataMapperResolverArgs(null, config)); //Act mapper.MapToProperty(context); //Assert //ME - I am not sure why I have to use the Arg.Is but just using item.Parent as the argument fails. service.Received().CreateType(config.PropertyInfo.PropertyType, Arg.Is<IContent>(x => x.Id == content.ParentId), false, false); }
public void MapToCms_ThrowsException() { //Assign var mapper = new UmbracoParentMapper(); //Act mapper.MapToCms(null); }
public void CanHandle_ConfigurationIsUmbracoInfo_ReturnsFalse() { //Assign var config = new UmbracoInfoConfiguration(); var mapper = new UmbracoParentMapper(); //Act var result = mapper.CanHandle(config, null); //Assert Assert.IsFalse(result); }