Esempio n. 1
0
        public void Configure_DefaultValues_ConfigHasDefaults()
        {
            //Assign
            var attr         = new StubQueryAttribute(string.Empty);
            var config       = new QueryConfiguration();
            var propertyInfo = typeof(StubItem).GetProperty("X");

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsFalse(config.InferType);
            Assert.IsFalse(config.IsRelative);
            Assert.IsEmpty(config.Query);
        }
Esempio n. 2
0
        public void Configure_QueryHasValue_ConfigQueryHasValue()
        {
            //Assign
            var query        = "some query";
            var attr         = new StubQueryAttribute(query);
            var config       = new QueryConfiguration();
            var propertyInfo = typeof(StubItem).GetProperty("X");

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsFalse(config.InferType);
            Assert.IsFalse(config.IsRelative);
            Assert.AreEqual(query, config.Query);
        }
Esempio n. 3
0
        public void Configure_DefaultValues_ConfigHasDefaults()
        {
            //Assign
            var attr         = new StubQueryAttribute(string.Empty);
            var config       = new QueryConfiguration();
            var propertyInfo = Substitute.For <PropertyInfo>();

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsTrue(config.IsLazy);
            Assert.IsFalse(config.InferType);
            Assert.IsFalse(config.IsRelative);
            Assert.IsNullOrEmpty(config.Query);
        }
Esempio n. 4
0
        public void Configure_QueryHasValue_ConfigQueryHasValue()
        {
            //Assign
            var query        = "some query";
            var attr         = new StubQueryAttribute(query);
            var config       = new QueryConfiguration();
            var propertyInfo = Substitute.For <PropertyInfo>();

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsTrue(config.IsLazy);
            Assert.IsFalse(config.InferType);
            Assert.IsFalse(config.IsRelative);
            Assert.AreEqual(query, config.Query);
        }
Esempio n. 5
0
        public void Configure_IsRelativeIsTrue_ConfigIsRelativeIsTrue()
        {
            //Assign
            var attr         = new StubQueryAttribute(string.Empty);
            var config       = new QueryConfiguration();
            var propertyInfo = typeof(StubItem).GetProperty("X");

            attr.IsRelative = true;

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsTrue(config.IsLazy);
            Assert.IsFalse(config.InferType);
            Assert.IsTrue(config.IsRelative);
            Assert.IsEmpty(config.Query);
        }
        public void Configure_QueryHasValue_ConfigQueryHasValue()
        {
            //Assign
            var query = "some query";
            var attr = new StubQueryAttribute(query);
            var config = new QueryConfiguration();
			var propertyInfo = typeof(StubItem).GetProperty("X");

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsTrue(config.IsLazy);
            Assert.IsFalse(config.InferType);
            Assert.IsFalse(config.IsRelative);
            Assert.AreEqual(query, config.Query);
        }
        public void Configure_DefaultValues_ConfigHasDefaults()
        {
            //Assign
            var attr = new StubQueryAttribute(string.Empty);
            var config = new QueryConfiguration();
			var propertyInfo = typeof(StubItem).GetProperty("X");

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsTrue(config.IsLazy);
            Assert.IsFalse(config.InferType);
            Assert.IsFalse(config.IsRelative);
            Assert.IsNullOrEmpty(config.Query);
        }
        public void Configure_IsLazyIsFalse_ConfigIsLazyIsFalse()
        {
            //Assign
            var attr = new StubQueryAttribute(string.Empty);
            var config = new QueryConfiguration();
            var propertyInfo = Substitute.For<PropertyInfo>();

            attr.IsLazy = false;

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsFalse(config.IsLazy);
            Assert.IsFalse(config.InferType);
            Assert.IsFalse(config.IsRelative);
            Assert.IsNullOrEmpty(config.Query);
        }