Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fabio Milheiro 74 posts 136 karma points
    Apr 07, 2014 @ 00:37
    Fabio Milheiro
    0

    Integration Test in Umbraco 7

    I am trying to create an integrated test in Umbraco here and, for that, I am using the the BaseRoutingTest class defined in the Umbraco.Tests.dll.

    [SetUp]
            public void SetUp()
            {
                this.umbracoContext = GetUmbracoContext("/", 0);
                this.contentService = this.umbracoContext.Application.Services.ContentService;
                this.contentTypeService = this.umbracoContext.Application.Services.ContentTypeService;
    
                this.userService = this.umbracoContext.Application.Services.UserService;
    
                this.testUserType = UserType.MakeNew("testUserType", "F:C54ZDMOSRPKAUHI", "testUserType");
                this.testUser = umbraco.BusinessLogic.User.MakeNew("testUser", "testUser", "testUser", this.testUserType);
    
                var homeContentType = new ContentType(-1);
                homeContentType.Alias = "Home";
                contentTypeService.Save(homeContentType);
    
                var home = contentService.CreateContent("test.com", -1, homeContentType.Alias, this.testUser.Id);
            }

    The problem is that, when running the last line of code, I get the following exception:

    Exception: System.TypeLoadException: Method 'CreateFragment' in type 'Umbraco.Tests.PublishedContent.SolidPublishedContentCache' from assembly 'Umbraco.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

    How has anyone come up with a way to create a integration test in Umbraco that actually works?

  • Fabio Milheiro 74 posts 136 karma points
    Apr 07, 2014 @ 23:56
    Fabio Milheiro
    0

    After investigation some more, there doesn't seem to be any "CreateFragment" method at all and certainly not in the SolidPublishedContentCache. Why should there be any?

    And if I run the method a second time, I get a different exception:

    Invalid Type: A Mapper could not be resolved based on the passed in Type
       at Umbraco.Core.Persistence.Mappers.MappingResolver.<>c__DisplayClass1.<ResolveMapperByType>b__0(Type type1)
       at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
       at Umbraco.Core.Persistence.Mappers.MappingResolver.ResolveMapperByType(Type type)
       at Umbraco.Core.Persistence.Querying.ModelToSqlExpressionHelper`1..ctor()
       at Umbraco.Core.Persistence.Querying.Query`1..ctor()
       at Umbraco.Core.Persistence.Querying.Query`1.get_Builder()
       at Umbraco.Core.Services.ContentService.FindContentTypeByAlias(String contentTypeAlias)
       at Umbraco.Core.Services.ContentService.CreateContent(String name, Int32 parentId, String contentTypeAlias, Int32 userId)

    What is going on here? Am I wrong to suppose there's a big here? Can anyone help with this?

Please Sign in or register to post replies

Write your reply to:

Draft