Exemplo n.º 1
0
        public void TestThatForeignKeysForDomainObjectGetGetsForeignKeysForIdentifiableDomainObject()
        {
            var dataProvider  = _systemDataRepository.DataProviderForFoodItemsGet();
            var foreignKeyFor = new ForeignKey(dataProvider, Guid.NewGuid(), typeof(ForeignKey), "Test")
            {
                Identifier = Guid.NewGuid()
            };
            // ReSharper disable PossibleInvalidOperationException
            var foreignKey = _systemDataRepository.Insert(new ForeignKey(dataProvider, foreignKeyFor.Identifier.Value, foreignKeyFor.GetType(), "Test"));

            // ReSharper restore PossibleInvalidOperationException
            try
            {
                var result = _systemDataRepository.ForeignKeysForDomainObjectGet(foreignKeyFor);
                // ReSharper disable PossibleMultipleEnumeration
                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.Not.Empty);
                // ReSharper restore PossibleMultipleEnumeration
            }
            finally
            {
                _systemDataRepository.Delete(foreignKey);
            }
        }