public void Execute_DataMapperAttribute_SetsResultToSpecifiedMapper()
        {
            //Assign

            var task          = new DataMapperAttributeResolverTask();
            var configuration = Substitute.For <AbstractPropertyConfiguration>();

            configuration.PropertyInfo = typeof(StubClass).GetProperty("StubMapperProperty");

            var args = new DataMapperResolverArgs(null, configuration);

            args.DataMappers = Enumerable.Empty <AbstractDataMapper>();

            //Act
            task.Execute(args);

            //Assert
            Assert.IsNotNull(args.Result);
            Assert.IsTrue(args.Result.GetType() == typeof(StubMapper));
        }
        public void Execute_DataMapperAttributeMapperMissingConstructor_SetsResultToSpecifiedMapper()
        {
            //Assign

            var task          = new DataMapperAttributeResolverTask();
            var configuration = Substitute.For <AbstractPropertyConfiguration>();

            configuration.PropertyInfo = typeof(StubClass).GetProperty("MissingConstructorStubMapperProperty");

            var args = new DataMapperResolverArgs(null, configuration);

            args.DataMappers = Enumerable.Empty <AbstractDataMapper>();

            //Act
            Assert.Throws <NotSupportedException>(() =>
            {
                task.Execute(args);
            });

            //Assert
        }
        public void Execute_DataMapperAttributeLoadedFromMapperCollection_SetsResultToSpecifiedMapper()
        {
            //Assign

            var task          = new DataMapperAttributeResolverTask();
            var configuration = Substitute.For <AbstractPropertyConfiguration>();

            configuration.PropertyInfo = typeof(StubClass).GetProperty("StubMapperProperty");

            var mapper = new StubMapper();

            var args = new DataMapperResolverArgs(null, configuration);

            args.DataMappers = new AbstractDataMapper[] { mapper };

            //Act
            task.Execute(args);

            //Assert
            Assert.IsNotNull(args.Result);
            Assert.AreEqual(mapper, args.Result);
        }