Code Monkey home page Code Monkey logo

episerver-fakemaker's People

Contributors

davidvujic avatar dependabot[bot] avatar psst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

episerver-fakemaker's Issues

Relation with ContentLoader

Hi David,
Your FakeMaker is great! I really enjoy working with it and I love it! So thanks a lot for this awesome tool. ๐Ÿ‘
Is it possible to use them in ContentLoader?
Right now I create everything in FakeMaker, but I also need ContentLoader in some places so I need to add all pages also in that. Is there any easier way?

mockContentLoader.Setup(r => r.Get<StartPage>(It.IsAny<ContentReference>())).Returns((StartPage)start.Page);

Using strongly typed page/content types with Get<> or GetChildren<>.

Hi David,

I saw your modifications for supporting start pages and read your blog bost, for me, using ContentReference.StartPage covers quite some (test) cases so I can now clean up the extra boiler plate, thanks and thanks for the credits :).

I have one more suggestion/improvement which imho is rather essential.
When pages are registered in the fake repository they get registered as IContent or PageData and not as the actual concrete types. So now whenever I request a PageData subclass, for example 'ProductOverviewPage' I get a null reference. I guess it will work when pages are registered using their actual concrete type, even when requesting a PageData type (I think).

The difficult part in setting up the mocked calls for the fake repository is that the Get<> and GetChildren<> methods are generic methods so it will be hard to register the actual types in the Moq Setup calls. At the moment there is only one place where you actually have the generic information and that is in the FakePage.Create<T>() method. It's ugly but in that place you could do something like: Func<IContentRepository, T> repoSetup = (repo) => repo.Get<T>(fake.Page.ContentLink);,and in FakeMaker.AddToRepository() you could request that delegate from the FakePage and use it in the Mock Setup call. But to do such a thing properly really means some architectual changes I guess.

Regards,

Robert.

FakeContent

Hi,
It would be convenient with FakeContent instead of FakePage so we can fake blocks as well.
I tried to do this by myself, but this method internal override void HelpCreatingMockForCurrentType(IFakeMaker maker) is marked as internal, so can't override it when inheriting from Fake. Do you mind changing it to public, and maybe add FakeContent as well?

Add a contributing.md

Add a "CONTRIBUTING.md" file to the project, describing how to contribute to the project.

Goals of the project?

Hi,

I wonder what is the scope of this project, what are the goals, how long have we (or you) come so-far?

Is the goal to mimick a full running EPiServer website for unit testing? Or is the goal to run the whole EPiServer engine in memory, without the need for a database? Or is the goal to cover most of the needed data-loading functionality that EPi provides?

What's the difference between other framework attempts, like that one by @joelabrahamsson?

Thanks!

EPiServer 9 support

I am trying FakeMaker and have an issue in EPiServer 9. Does FakeMaker support it?

I have this at runtime:

Result Message: System.IO.FileNotFoundException : Could not load file or assembly 'EPiServer.BaseLibrary, Version=8.5.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' or one of its dependencies. The system cannot find the file specified.

According to documentation EPiServer.BaseLibrary is removed in EPiServer 9:
http://world.episerver.com/documentation/Items/Upgrading/EPiServer-CMS/9/Breaking-changes/

Add a setup/get started info text

Add instructions on how (and where) to add FakeMaker to the code base.
Both alternatives: via NuGet and the GitHub source code.

The Readme file is probably the best place for it.

Exception when running tests

I installed the latest version and got this exception:
image

It seems that two versions of StructureMap is installed - 3.x and 4. I tried to remove StructureMap 4, but FakeMaker depends on it.

IContentLoader.Get with InvariantCulture returns null

I just found an issue when passing InvariantCulture to Get method of IContentLoader, it returns null while it should:

If CultureInfo.InvariantCulture is passed in, the provider should return content in the master language.

It also causes other methods to not function correctly. For example, IContentLoader.GetAncestors - internally it uses Get with InvariantCulture.

Dealing with ContentReference.StartPage.

Hi,

This is not really an issue but more a suggestion.
It would be nice if there was a way to somehow mark a page as the start-page so you would be able to do something like _fake.ContentRepository.GetChildren<PageData>(ContentReference.StartPage);

As an alternative I've used something like the following:

FakePage rootPage = FakePage.Create("Root");
FakePage startPage = FakePage.Create("Start").ChildOf(rootPage);
FakePage.Create("Child 1").ChildOf(startPage);
FakePage.Create("Child 2").ChildOf(startPage);
FakePage.Create("Child 3").ChildOf(startPage);

_fake.AddToRepository(rootPage);

Mock<IContentRepository> contentRepositoryMock = _fake.GetMockForFakeContentRepository();
contentRepositoryMock.Setup(x => x.GetChildren<PageData>(ContentReference.StartPage)).Returns(startPage.Children.Select(x => x.Page));

Regards,

Robert.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.