Esempio n. 1
0
        public void UnifyWithEquivalentProperties_ThrowsForDifferentStoragePropertyType()
        {
            var property2 = CompoundStoragePropertyDefinitionObjectMother.CreateWithTwoProperties();

            Assert.That(
                () => _storagePropertyDefinition.UnifyWithEquivalentProperties(new[] { property2 }),
                Throws.ArgumentException.With.Message.EqualTo(
                    "Only equivalent properties can be combined, but this property has type 'SimpleStoragePropertyDefinition', and the given property has "
                    + "type 'CompoundStoragePropertyDefinition'.\r\nParameter name: equivalentProperties"));
        }
Esempio n. 2
0
        public void CreateForScalarQuery_TooComplexParameter()
        {
            var queryStub = MockRepository.GenerateStub <IQuery> ();

            queryStub.Stub(stub => stub.Statement).Return("statement");
            queryStub.Stub(stub => stub.Parameters).Return(new QueryParameterCollection {
                new QueryParameter("p1", Tuple.Create(1, "a"))
            });

            var compoundProperty = CompoundStoragePropertyDefinitionObjectMother.CreateWithTwoProperties();

            _dataStoragePropertyDefinitionFactoryStrictMock
            .Stub(stub => stub.CreateStoragePropertyDefinition(Tuple.Create(1, "a")))
            .Return(compoundProperty);
            _dataStoragePropertyDefinitionFactoryStrictMock.Replay();

            Assert.That(() => _factory.CreateForScalarQuery(queryStub), Throws.InvalidOperationException.With.Message.EqualTo(
                            "The query parameter 'p1' is mapped to 2 database-level values. Only values that map to a single database-level value can be used as query "
                            + "parameters."));
        }