Skip to content

Instantly share code, notes, and snippets.

@pauldambra
Created September 16, 2016 16:10
Show Gist options
  • Save pauldambra/6b9cee1d7c39aa7893606927ca969d22 to your computer and use it in GitHub Desktop.
Save pauldambra/6b9cee1d7c39aa7893606927ca969d22 to your computer and use it in GitHub Desktop.
akka.net test that fails before Tell has had time to run
public class WhenContentWasAlreadyPublished : TestKit, ILoadUmbracoNodes, IPublishUmbracoContent
{
private IContent _content;
private IContent _publishedContent;
private bool _publishContentCalled;
[Fact]
public void ItPublishesWhenAsked()
{
var publisherProps = UmbracoAdmin.ContentPublishing.NodePublisher.Props(this, this);
var publisher = Sys.ActorOf(publisherProps);
publisher.Tell(Get(1));
_publishContentCalled.Should().BeTrue();
_publishedContent.Should().Be(_content);
}
public IContent Get(int id)
{
_content = A.Fake<IContent>();
A.CallTo(() => _content.HasPublishedVersion).Returns(true);
return _content;
}
public Attempt<PublishStatus> Publish(IContent content)
{
_publishedContent = content;
_publishContentCalled = true;
return Attempt<PublishStatus>.Succeed();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment