public void InitializedWithComposerHasCorrectComposer()
 {
     // Fixture setup
     var expectedComposer = new DelegatingFixture();
     var sut = new AutoDataAttribute(expectedComposer);
     // Exercise system
     var result = sut.Fixture;
     // Verify outcome
     Assert.Equal(expectedComposer, result);
     // Teardown
 }
 public void GetDataOrdersCustomizationAttributes(string methodName)
 {
     // Fixture setup
     var method = new MethodWrapper(typeof(TypeWithCustomizationAttributes), methodName);
     var customizationLog = new List<ICustomization>();
     var fixture = new DelegatingFixture();
     fixture.OnCustomize = c =>
     {
         customizationLog.Add(c);
         return fixture;
     };
     var sut = new AutoDataAttributeStub(fixture);
     // Exercise system
     sut.BuildFrom(method, new TestSuite(this.GetType())).Single();
     // Verify outcome
     Assert.False(customizationLog[0] is FreezeOnMatchCustomization);
     Assert.True(customizationLog[1] is FreezeOnMatchCustomization);
     // Teardown
 }
        public void GetDataReturnsCorrectResult()
        {
            // Fixture setup
            var method = typeof(TypeWithOverloadedMembers).GetMethod("DoSomething", new[] { typeof(object) });
            var parameters = method.GetParameters();
            var parameterTypes = (from pi in parameters
                                  select pi.ParameterType).ToArray();

            var expectedResult = new object();
            var builder = new DelegatingSpecimenBuilder
            {
                OnCreate = (r, c) =>
                    {
                        Assert.Equal(parameters.Single(), r);
                        Assert.NotNull(c);
                        return expectedResult;
                    }
            };
            var composer = new DelegatingFixture { OnCompose = () => builder };

            var sut = new AutoDataAttribute(composer);
            // Exercise system
            var result = sut.GetData(method, parameterTypes);
            // Verify outcome
            Assert.True(new[] { expectedResult }.SequenceEqual(result.Single()));
            // Teardown
        }
 public void GetDataOrdersCustomizationAttributes(string methodName)
 {
     // Fixture setup
     var method = typeof(TypeWithCustomizationAttributes).GetMethod(methodName, new[] { typeof(ConcreteType) });
     var customizationLog = new List<ICustomization>();
     var fixture = new DelegatingFixture();
     fixture.OnCustomize = c =>
     {
         customizationLog.Add(c);
         return fixture;
     };
     var sut = new AutoDataAttribute(fixture);
     // Exercise system
     sut.GetData(method);
     // Verify outcome
     Assert.False(customizationLog[0] is FreezeOnMatchCustomization);
     Assert.True(customizationLog[1] is FreezeOnMatchCustomization);
     // Teardown
 }