public virtual void Dehydrate() { var result = new MockContainer(EntityWithResolvedRefs).DehydrateReferences(); result.Entities.First() .Should().Be(EntityWithDehydratedRefs); }
public void Resolve() { var repositoryMock = new Mock <ICrudRepository <TRef> >(MockBehavior.Strict); if (DehydratedRef.Id != Entity.NoId) { repositoryMock.Setup(x => x.Find(DehydratedRef.Id)) .Returns(ResolvedRef); } var factoryMock = new Mock <IReadRepositoryFactory>(MockBehavior.Loose); factoryMock.Setup(x => x.Create <TRef>()) .Returns(repositoryMock.Object); var result = new MockContainer(EntityWithDehydratedRefs).ResolveReferences(factoryMock.Object); result.Entities.First() .Should().Be(EntityWithResolvedRefs); factoryMock.VerifyAll(); repositoryMock.VerifyAll(); }