示例#1
0
        public void Get_generic_attribute_from_type()
        {
            // Act
            AttributeFixture attribute =
                AttributeCache.GetAttribute <AttributeFixture>(typeof(TypePoolFixture));

            // Assert
            Assert.IsNotNull(attribute);
        }
示例#2
0
        public void Get_generic_attribute_on_type_with_predicate()
        {
            // Act
            AttributeFixture attribute =
                AttributeCache.GetAttribute <AttributeFixture>(typeof(TypePoolFixture), null, a => a.IsEnabled);

            // Assert
            Assert.IsNotNull(attribute);
            Assert.IsTrue(attribute.IsEnabled);
        }
示例#3
0
        public void Get_generic_attribute_from_instance()
        {
            // Arrange
            var fixture = new TypePoolFixture();

            // Act
            AttributeFixture attribute =
                AttributeCache.GetAttribute <AttributeFixture, TypePoolFixture>();

            // Assert
            Assert.IsNotNull(attribute);
        }
示例#4
0
        public void Get_generic_single_attribute_from_instance_property()
        {
            // Arrange
            var fixture  = new TypePoolFixture();
            var property = typeof(TypePoolFixture).GetProperty(fixture.GetPropertyName(p => p.PropertyWithAttribute));

            // Act
            AttributeFixture attribute =
                AttributeCache.GetAttribute <AttributeFixture, TypePoolFixture>(property, fixture);

            // Assert
            Assert.IsNotNull(attribute);
        }
示例#5
0
        public void Get_generic_attribute_from_null_property_and_null_instance_with_predicate()
        {
            // Arrange
            var fixture  = new TypePoolFixture();
            var property = typeof(TypePoolFixture).GetProperty(fixture.GetPropertyName(p => p.PropertyWithAttribute));

            // Act
            AttributeFixture attribute =
                AttributeCache.GetAttribute <AttributeFixture, TypePoolFixture>(
                    null, null, a => a.IsEnabled);

            // Assert
            Assert.IsNotNull(attribute);
        }
示例#6
0
        public void Get_generic_attribute_from_property_on_type_with_predicate()
        {
            // Arrange
            var fixture  = new TypePoolFixture();
            var property = typeof(TypePoolFixture).GetProperty(fixture.GetPropertyName(p => p.PropertyWithAttribute));

            // Act
            AttributeFixture attribute =
                AttributeCache.GetAttribute <AttributeFixture>(typeof(TypePoolFixture), property, a => a.IsEnabled);

            // Assert
            Assert.IsNotNull(attribute);
            Assert.IsTrue(attribute.IsEnabled);
        }
示例#7
0
 public void Get_generic_attribute_on_null_type()
 {
     // Act
     AttributeFixture attribute = AttributeCache.GetAttribute <AttributeFixture>(null, null, null);
 }
示例#8
0
 public TodoItemControllerAttributesTests(AttributeFixture <TodoItemController> attribute)
 {
     _attribute = attribute ?? throw new ArgumentNullException(nameof(attribute));
 }