I'd say FakeDb is outdated and I'd not recommend using it nowadays. Sitecore 9 brought abstractions so regular mocks can be utilized.
AutoFixture and Sitecore Customizations for AutoFixture help to reduce the amount of code needed to get started. See how the success scenario could look like:
[Theory, AutoNSubstituteData]
public void GetItemByShortPathReturnsExpectedIfFound(
Database database, Item expected)
{
var siteContext = new SiteContext(new SiteInfo(new StringDictionary
{
{ "rootPath", "/sitecore/content/mysite" },
{ "startItem", "home" }
}))
{
Database = database
};
database.GetItem("/sitecore/content/mysite/home/page1").Returns(expected);
var actual = MyService.GetItemByShortPath(siteContext, "page1");
Assert.Same(expected, actual);
}
Of course, there shold be more test to cover all the possible scenarions, e.g. what if database is null, what if /short-path
(with extra slash) is passed instead of short-path
etc. But, general idea should be clear.
In order to make it working, just copy few classes from here into your solution. The entire repo can be used as a reference.