Ejemplo n.º 1
0
        public void DomainEntity_AssocatedWithBehavior()
        {
            var resolver = new MockResolver();
            var factory  = new DomainEntityFactory(resolver);

            factory.AddBehavior <IMockDomainBehavior, MockGlobalDomainBehavior>();

            var domainEntity = factory.Create <MockDomainEntity>();
            var behavior     = domainEntity.Entity.GetBehavior <IMockDomainBehavior>();

            domainEntity.Should().BeSameAs(behavior.instance.DomainEntity);
        }
Ejemplo n.º 2
0
        public void BehaviorServices_AreResolved()
        {
            var resolver = new MockResolver();
            var factory  = new DomainEntityFactory(resolver);

            factory.AddBehavior <IMockDomainBehavior, MockGlobalDomainBehavior>();

            resolver.ResolveCount.Should().Be(0);
            var domainEntity = factory.Create <MockDomainEntity>();
            var behavior     = domainEntity.Entity.GetBehavior <IMockDomainBehavior>();

            resolver.ResolveCount.Should().Be(1);
        }