public void SutIsDataAttribute()
        {
            // Arrange
            // Act
            var sut = new CompositeDataAttribute();

            // Assert
            Assert.IsInstanceOf <DataAttribute>(sut);
        }
Exemplo n.º 2
0
        public void GetDataWithNullMethodThrows()
        {
            // Arrange
            var sut = new CompositeDataAttribute();

            // Act & assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.GetData(null).ToList());
        }
 public void SutIsDataAttribute()
 {
     // Fixture setup
     // Exercise system
     var sut = new CompositeDataAttribute();
     // Verify outcome
     Assert.IsAssignableFrom<DataAttribute>(sut);
     // Teardown
 }
        public void GetArgumentsReturnsCorrectResult(IEnumerable <DataAttribute> attributes, IEnumerable <object[]> expectedResult)
        {
            // Arrange
            // Act
            var result = new CompositeDataAttribute(attributes).GetData(this.method).ToList();

            // Assert
            Assert.True(expectedResult.SequenceEqual(result, new TheoryComparer()));
        }
Exemplo n.º 5
0
        public void SutIsDataAttribute()
        {
            // Arrange
            // Act
            var sut = new CompositeDataAttribute();

            // Assert
            Assert.IsAssignableFrom <DataAttribute>(sut);
        }
        public void GetDataWithNullTypesThrows()
        {
            // Arrange
            var    sut = new CompositeDataAttribute();
            Action a   = delegate { };

            // Act & assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.GetData(a.Method, null).ToList());
        }
        public void SutIsDataAttribute()
        {
            // Fixture setup
            // Exercise system
            var sut = new CompositeDataAttribute();

            // Verify outcome
            Assert.IsInstanceOf <DataAttribute>(sut);
            // Teardown
        }
        public void GetArgumentsWithNullMethodThrows()
        {
            // Fixture setup
            var sut = new CompositeDataAttribute();

            // Exercise system and verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.GetData(null).ToList());
            // Teardown
        }
Exemplo n.º 9
0
        public void GetDataReturnsCorrectResult(IEnumerable <DataAttribute> attributes, IEnumerable <object[]> expectedResult)
        {
            // Fixture setup
            // Exercise system
            var result = new CompositeDataAttribute(attributes).GetData(this.method, this.parameterTypes).ToList();

            // Verify outcome
            Assert.True(expectedResult.SequenceEqual(result, new TheoryComparer()));
            // Teardown
        }
        public void GetDataWithNullTypesThrows()
        {
            // Fixture setup
            var    sut = new CompositeDataAttribute();
            Action a   = delegate { };

            // Exercise system and verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.GetData(a.Method, null).ToList());
            // Teardown
        }
        public void GetDataReturnsCorrectResult(IEnumerable <DataAttribute> attributes, IEnumerable <object[]> expectedResult)
        {
            // Fixture setup
            // Exercise system
            var sut        = new CompositeDataAttribute(attributes.ToArray());
            var testMethod = sut.ToTestMethod(method);
            var result     = sut.GetData(testMethod).ToList();

            // Verify outcome
            Assert.IsTrue(expectedResult.SequenceEqual(result, new TheoryComparer()));
            // Teardown
        }
        public void GetArgumentsOnMethodWithNoParametersReturnsNoTheory()
        {
            // Arrange
            Action a      = () => { };
            var    method = a.Method;

            var sut = new CompositeDataAttribute(
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()));

            // Act & Assert
            var result = sut.GetData(a.Method);

            Array.ForEach(result.ToArray(), Assert.IsEmpty);
        }
        public void GetArgumentsOnMethodWithNoParametersReturnsNoTheory()
        {
            // Fixture setup
            Action a      = delegate { };
            var    method = a.Method;

            var sut = new CompositeDataAttribute(
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>())
                );

            // Exercise system and verify outcome
            var result = sut.GetData(a.Method);

            Array.ForEach(result.ToArray(), Assert.IsEmpty);
            // Teardown
        }
Exemplo n.º 14
0
        public void GetDataOnMethodWithNoParametersReturnsNoTheory()
        {
            // Arrange
            Action a              = () => { };
            var    method         = a.GetMethodInfo();
            var    parameters     = method.GetParameters();
            var    parameterTypes = (from pi in parameters
                                     select pi.ParameterType).ToArray();

            var sut = new CompositeDataAttribute(
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()));

            // Act & assert
            var result = sut.GetData(a.GetMethodInfo());

            result.ToList().ForEach(Assert.Empty);
        }
        public void GetDataOnMethodWithNoParametersReturnsNoTheory()
        {
            // Arrange
            Action a              = delegate { };
            var    method         = a.Method;
            var    parameters     = method.GetParameters();
            var    parameterTypes = (from pi in parameters
                                     select pi.ParameterType).ToArray();

            var sut = new CompositeDataAttribute(
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>())
                );

            // Act & assert
            var result = sut.GetData(a.Method, Type.EmptyTypes);

            Array.ForEach(result.ToArray(), Assert.Empty);
        }
        public void AttributesIsCorrectWhenInitializedWithEnumerable()
        {
            // Fixture setup
            Action a = delegate { };
            var method = a.Method;
            
            var attributes = new[]
            {
                new FakeDataAttribute(method, Enumerable.Empty<object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty<object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty<object[]>())
            };

            var sut = new CompositeDataAttribute(attributes);
            // Exercise system
            var result = sut.Attributes;
            // Verify outcome
            Assert.True(attributes.SequenceEqual(result));
            // Teardown
        }
Exemplo n.º 17
0
        public void AttributesIsCorrectWhenInitializedWithEnumerable()
        {
            // Arrange
            Action a      = () => { };
            var    method = a.GetMethodInfo();

            var attributes = new[]
            {
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>())
            };

            var sut = new CompositeDataAttribute(attributes);
            // Act
            var result = sut.Attributes;

            // Assert
            Assert.True(attributes.SequenceEqual(result));
        }
        public void AttributesIsCorrectWhenInitializedWithArray()
        {
            // Arrange
            Action a      = delegate { };
            var    method = a.Method;

            var attributes = new[]
            {
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>())
            };

            var sut = new CompositeDataAttribute(attributes);
            // Act
            IEnumerable <DataAttribute> result = sut.Attributes;

            // Assert
            Assert.True(attributes.SequenceEqual(result));
        }
        public void GetDataOnMethodWithNoParametersReturnsNoTheory()
        {
            // Fixture setup
            Action a              = delegate { };
            var    method         = a.Method;
            var    parameters     = method.GetParameters();
            var    parameterTypes = (from pi in parameters
                                     select pi.ParameterType).ToArray();

            var sut = new CompositeDataAttribute(
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>())
                );

            // Exercise system and verify outcome
            var result = sut.GetData(a.Method, Type.EmptyTypes);

            Array.ForEach(result.ToArray(), Assert.Empty);
            // Teardown
        }
        public void AttributesIsCorrectWhenInitializedWithEnumerable()
        {
            // Fixture setup
            Action a      = delegate { };
            var    method = a.Method;

            var attributes = new[]
            {
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, Enumerable.Empty <object[]>())
            };

            var sut = new CompositeDataAttribute(attributes);
            // Exercise system
            var result = sut.Attributes;

            // Verify outcome
            Assert.True(attributes.SequenceEqual(result));
            // Teardown
        }
        public void AttributesIsCorrectWhenInitializedWithArray()
        {
            // Fixture setup
            Action a = delegate { };
            var method = a.Method;
            var parameters = method.GetParameters();
            var parameterTypes = (from pi in parameters
                                  select pi.ParameterType).ToArray();

            var attributes = new[]
            {
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty<object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty<object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty<object[]>())
            };

            var sut = new CompositeDataAttribute(attributes);
            // Exercise system
            IEnumerable<DataAttribute> result = sut.Attributes;
            // Verify outcome
            Assert.True(attributes.SequenceEqual(result));
            // Teardown
        }
        public void AttributesIsCorrectWhenInitializedWithEnumerable()
        {
            // Arrange
            Action a              = delegate { };
            var    method         = a.Method;
            var    parameters     = method.GetParameters();
            var    parameterTypes = (from pi in parameters
                                     select pi.ParameterType).ToArray();

            var attributes = new[]
            {
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>())
            };

            var sut = new CompositeDataAttribute(attributes);
            // Act
            var result = sut.Attributes;

            // Assert
            Assert.True(attributes.SequenceEqual(result));
        }
        public void AttributesIsCorrectWhenInitializedWithArray()
        {
            // Fixture setup
            Action a              = delegate { };
            var    method         = a.Method;
            var    parameters     = method.GetParameters();
            var    parameterTypes = (from pi in parameters
                                     select pi.ParameterType).ToArray();

            var attributes = new[]
            {
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>()),
                new FakeDataAttribute(method, parameterTypes, Enumerable.Empty <object[]>())
            };

            var sut = new CompositeDataAttribute(attributes);
            // Exercise system
            IEnumerable <DataAttribute> result = sut.Attributes;

            // Verify outcome
            Assert.True(attributes.SequenceEqual(result));
            // Teardown
        }
 public void GetDataWithNullMethodThrows()
 {
     // Fixture setup
     var sut = new CompositeDataAttribute();
     var dummyTypes = Type.EmptyTypes;
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.GetData(null, dummyTypes).ToList());
     // Teardown
 }
        public void GetDataOnMethodWithNoParametersReturnsNoTheory()
        {
            // Fixture setup
            Action a = delegate { };
            var method = a.Method;
            var parameters = method.GetParameters();
            var parameterTypes = (from pi in parameters
                                  select pi.ParameterType).ToArray();

            var sut = new CompositeDataAttribute(
               new FakeDataAttribute(method, parameterTypes, Enumerable.Empty<object[]>()),
               new FakeDataAttribute(method, parameterTypes, Enumerable.Empty<object[]>()),
               new FakeDataAttribute(method, parameterTypes, Enumerable.Empty<object[]>())
               );

            // Exercise system and verify outcome
            var result = sut.GetData(a.Method, Type.EmptyTypes);
            Array.ForEach(result.ToArray(), Assert.Empty);
            // Teardown
        }
 public void GetDataWithNullTypesThrows()
 {
     // Fixture setup
     var sut = new CompositeDataAttribute();
     Action a = delegate { };
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.GetData(a.Method, null).ToList());
     // Teardown
 }
        public void GetArgumentsOnMethodWithNoParametersReturnsNoTheory()
        {
            // Fixture setup
            Action a = delegate { };
            var method = a.Method;
            
            var sut = new CompositeDataAttribute(
               new FakeDataAttribute(method, Enumerable.Empty<object[]>()),
               new FakeDataAttribute(method, Enumerable.Empty<object[]>()),
               new FakeDataAttribute(method, Enumerable.Empty<object[]>())
               );

            // Exercise system and verify outcome
            var result = sut.GetData(a.Method);
            Array.ForEach(result.ToArray(), Assert.IsEmpty);
            // Teardown
        }