public void NamedArgument()
            {
                var input = new[] { "named" };

                var customAttributeDataMock          = MockRepository.GenerateStrictMock <ICustomAttributeData> ();
                var customAttributeNamedArgumentMock = MockRepository.GenerateStrictMock <ICustomAttributeNamedArgument>();

                customAttributeNamedArgumentMock
                .Expect(x => x.MemberInfo)
                .Return(typeof(DomainAttribute).GetFields().Single());
                customAttributeNamedArgumentMock
                .Expect(x => x.MemberType)
                .Return(typeof(string[]));
                customAttributeNamedArgumentMock
                .Expect(x => x.Value)
                .Return(input);
                customAttributeDataMock
                .Expect(x => x.Constructor)
                .Return(typeof(DomainAttribute).GetConstructor(Type.EmptyTypes));
                customAttributeDataMock
                .Expect(x => x.ConstructorArguments)
                .Return(new ReadOnlyCollection <object> (new object[0]));
                customAttributeDataMock
                .Expect(x => x.NamedArguments)
                .Return(new ReadOnlyCollectionDecorator <ICustomAttributeNamedArgument> (new[] { customAttributeNamedArgumentMock }))
                .Repeat.Twice();

                var result = ICustomAttributeDataExtensions.CreateAttribute <DomainAttribute> (customAttributeDataMock);

                Assert.That(result.Field, Is.Not.SameAs(input));
                Assert.That(result.Field, Is.EqualTo(input));
            }
            public void DefaultConstructor()
            {
                var customAttributeDataMock = MockRepository.GenerateStrictMock <ICustomAttributeData>();

                customAttributeDataMock
                .Expect(x => x.Constructor)
                .Return(typeof(DomainAttribute).GetConstructor(Type.EmptyTypes));
                customAttributeDataMock
                .Expect(x => x.ConstructorArguments)
                .Return(new ReadOnlyCollection <object>(new object[0]));
                customAttributeDataMock
                .Expect(x => x.NamedArguments)
                .Return(new ReadOnlyCollectionDecorator <ICustomAttributeNamedArgument> (new ICustomAttributeNamedArgument[0]))
                .Repeat.Twice();

                var result = ICustomAttributeDataExtensions.CreateAttribute(customAttributeDataMock);

                Assert.That(result, Is.TypeOf <DomainAttribute>());
            }
            public void ConstructorWithArgument()
            {
                var input = new[] { "ctor" };

                var customAttributeDataMock = MockRepository.GenerateStrictMock <ICustomAttributeData> ();

                customAttributeDataMock
                .Expect(x => x.Constructor)
                .Return(typeof(DomainAttribute).GetConstructor(new[] { typeof(string) }));
                customAttributeDataMock
                .Expect(x => x.ConstructorArguments)
                .Return(new ReadOnlyCollection <object> (input));
                customAttributeDataMock
                .Expect(x => x.NamedArguments)
                .Return(new ReadOnlyCollectionDecorator <ICustomAttributeNamedArgument> (new ICustomAttributeNamedArgument[0]))
                .Repeat.Twice();

                var result = ICustomAttributeDataExtensions.CreateAttribute <DomainAttribute> (customAttributeDataMock);

                Assert.That(result, Is.Not.SameAs(input));
                Assert.That(result.ConstructorArgument, Is.EqualTo("ctor"));
            }