コード例 #1
0
        public void CheckSingleQueryEventHandlerThrowExceptionFlagFalse()
        {
            // Arrange
            var eventHandler = new TestRepositoryQueriedEvent();
            var repository   = new FamilyQueryRepository(new QueryEventHandler(eventHandler));

            // Act
            var entity     = repository.GetEntity <Person>(p => p.Id == Names.AimmeOsborne, false);
            var queryEvent = (SimpleRepositoryQueryEvent)eventHandler.QueriedEventList.Single();

            // Assert
            Assert.IsNotNull(entity);
            Assert.IsFalse(queryEvent.ThrowExceptionIfZeroOrManyFound.Value);
        }
コード例 #2
0
        //[Test]
        public void CheckSimpleEntitiesQueryEventHandler()
        {
            // Arrange
            var eventHandler = new TestRepositoryQueriedEvent();
            var repository   = new FamilyQueryRepository(new QueryEventHandler(eventHandler));

            // Act
            repository.GetEntities <Person>();
            var queryEvent = (SimpleRepositoryQueryEvent)eventHandler.QueriedEventList.Single();

            // Assert
            Assert.IsInstanceOf <DefaultQueryStrategy>(queryEvent.QueryStrategy);
            Assert.IsTrue(queryEvent.QueryStrategy == null);
            Assert.IsNull(queryEvent.ThrowExceptionIfZeroOrManyFound);
        }