public void Configure_ConfigurationIsIncorrectType_ExceptionThrown() { //Assign var attr = new SitecoreTypeAttribute(); var config = Substitute.For<AbstractTypeConfiguration>(); var type = typeof(StubClass); var templateIdExpected = Guid.Empty; var branchIdExptected = Guid.Empty; //Act attr.Configure(type, config); //Assert }
public void Configure_ConfigurationIsOfCorrectType_NoExceptionThrown() { //Assign var attr = new SitecoreTypeAttribute(); var type = typeof (StubClass); var templateIdExpected = Guid.Empty; var branchIdExptected = Guid.Empty; //Act var config = attr.Configure(type) as SitecoreTypeConfiguration; //Assert Assert.AreEqual(type, config.Type); Assert.AreEqual(new ID(templateIdExpected), config.TemplateId); Assert.AreEqual(new ID(branchIdExptected), config.BranchId); }
public void Configure_AttributeHasTemplateId_TemplateIdSetOnConfig() { //Assign var attr = new SitecoreTypeAttribute(); var type = typeof(StubClass); var templateIdExpected = new Guid(); var branchIdExptected = Guid.Empty; attr.TemplateId = templateIdExpected.ToString(); //Act var config = attr.Configure(type) as SitecoreTypeConfiguration; //Assert Assert.AreEqual(type, config.Type); Assert.AreEqual(new ID( templateIdExpected), config.TemplateId); Assert.AreEqual(new ID(branchIdExptected), config.BranchId); }
public void Configure_AttributeHasInvalidBranchId_ExceptionThrown() { //Assign var attr = new SitecoreTypeAttribute(); var config = new SitecoreTypeConfiguration(); var type = typeof(StubClass); var templateIdExpected = Guid.Empty; var branchIdExptected = Guid.Empty; attr.BranchId = "not a guid"; //Act attr.Configure(type, config); //Assert }
public void Configure_AttributeHasInvalidTemplateId_ExceptionThrown() { //Assign var attr = new SitecoreTypeAttribute(); var type = typeof(StubClass); var templateIdExpected = Guid.Empty; var branchIdExptected = Guid.Empty; attr.TemplateId = "not a guid"; //Act Assert.Throws<MapperException>(() => { var config = attr.Configure(type) as SitecoreTypeConfiguration; }); //Assert }