Example #1
0
        /// <summary>
        /// ITestStep.Execute() implementation
        /// </summary>
        /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
        public override void Execute(Context context)
        {
            var mapType = ObjectCreator.GetType(_mapTypeName, _mapAssemblyPath);

            var destDir = Path.GetDirectoryName(_destination);

            if ((destDir.Length > 0) && !Directory.Exists(destDir))
            {
                Directory.CreateDirectory(destDir);
            }

            var bmt = new BizTalkMapTester(mapType);

            bmt.Execute(_source, _destination);

            Stream data;

            using (var fs = new FileStream(_destination, FileMode.Open, FileAccess.Read))
            {
                data = StreamHelper.LoadMemoryStream(fs);
            }

            data.Seek(0, SeekOrigin.Begin);
            foreach (var subStep in SubSteps)
            {
                data = subStep.Execute(data, context);
            }
        }
Example #2
0
        /// <summary>
        ///     ITestStep.Execute() implementation
        /// </summary>
        /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
        public override void Execute(Context context)
        {
            var mapType = ObjectCreator.GetType(MapTypeName, MapAssemblyPath);

            var destDir = Path.GetDirectoryName(Destination);

            if ((destDir.Length > 0) && !Directory.Exists(destDir))
            {
                Directory.CreateDirectory(destDir);
            }

            var bmt = new BizTalkMapTester(mapType);

            bmt.Execute(Source, Destination);

            using (var fs = new FileStream(Destination, FileMode.Open, FileAccess.Read))
            {
                using (var data = StreamHelper.LoadMemoryStream(fs))
                {
                    data.Seek(0, SeekOrigin.Begin);
                    SubSteps.Aggregate(data, (current, subStep) => subStep.Execute(current, context));
                }
            }
        }