Esempio n. 1
0
        public virtual void Dehydrate()
        {
            var result = new MockContainer(EntityWithResolvedRefs).DehydrateReferences();

            result.Entities.First()
            .Should().Be(EntityWithDehydratedRefs);
        }
Esempio n. 2
0
        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();
        }