private void CalculateTotalsOnResultsRoot(resultType result)
        {
            var resultItems = result.testsuite.results.Items.ToList();
            var cases       = resultItems
                              .Where(x => x.GetType() == typeof(testsuiteType))
                              .Cast <testsuiteType>()
                              .SelectMany(x => x.results.Items)
                              .Where(x => x.GetType() == typeof(testcaseType))
                              .Cast <testcaseType>();

            var testcaseTypes = cases as testcaseType[] ?? cases.ToArray();

            if (!testcaseTypes.Any())
            {
                return;
            }

            result.errors = testcaseTypes.Sum(x => x.result == "Failure" ? 1 : 0);
            result.total  = testcaseTypes.Count();

            result.ignored      = testcaseTypes.Sum(x => x.result == "Ignored" ? 1 : 0);
            result.inconclusive = testcaseTypes.Sum(x => x.result == "Inconclusive" ? 1 : 0);
            result.invalid      = testcaseTypes.Sum(x => x.result == "Invalid" ? 1 : 0);
            result.notrun       = testcaseTypes.Sum(x => x.executed == "NotRun" ? 1 : 0);
            result.skipped      = testcaseTypes.Sum(x => x.result == "Skipped" ? 1 : 0);
            result.errors       = testcaseTypes.Sum(x => x.result == "Error" ? 1 : 0);
            result.failures     = testcaseTypes.Sum(x => x.result == "Failure" ? 1 : 0);
        }
Пример #2
0
        private static resultType LoadResults(string resultsPath)
        {
            resultType results = null;

            //write to the file
            var x = new XmlSerializer(typeof(resultType));

            using (var reader = new StreamReader(resultsPath))
            {
                results = (resultType)x.Deserialize(reader);
            }

            return(results);
        }
        public static resultType DeserializeResults(string resultsPath)
        {
            if (!File.Exists(resultsPath))
            {
                return(null);
            }

            resultType results = null;

            //write to the file
            var x = new XmlSerializer(typeof(resultType));

            using (var reader = new StreamReader(resultsPath))
            {
                results = (resultType)x.Deserialize(reader);
            }

            return(results);
        }
        /// <summary>
        /// Sets up an NUNit ResultsType object or deserializing and existing one.
        /// </summary>
        private void InitializeResults()
        {
            if (File.Exists(resultsPath))
            {
                //read from the file
                var x = new XmlSerializer(typeof(resultType));
                using (var sr = new StreamReader(resultsPath))
                {
                    resultsRoot = (resultType)x.Deserialize(sr);
                }
            }
            else
            {
                //create one result to dump everything into
                resultsRoot = new resultType {
                    name = Assembly.GetExecutingAssembly().Location
                };

                resultsRoot.testsuite = new testsuiteType
                {
                    name        = "DynamoTestFrameworkTests",
                    description = "Unit tests in Revit.",
                    time        = "0.0",
                    type        = "TestFixture",
                    result      = "Success",
                    executed    = "True"
                };

                resultsRoot.testsuite         = rootSuite;
                resultsRoot.testsuite.results = new resultsType {
                    Items = new object[] { }
                };
                resultsRoot.date         = DateTime.Now.ToString("yyyy-MM-dd");
                resultsRoot.time         = DateTime.Now.ToString("HH:mm:ss");
                resultsRoot.failures     = 0;
                resultsRoot.ignored      = 0;
                resultsRoot.notrun       = 0;
                resultsRoot.errors       = 0;
                resultsRoot.skipped      = 0;
                resultsRoot.inconclusive = 0;
                resultsRoot.invalid      = 0;
            }
        }
Пример #5
0
 public static List<TestCaseRepresentation> Adapt(MergeResult mr, resultType rt)
 {
     List<TestCaseRepresentation> result = new List<TestCaseRepresentation>();
     List<TestCase> testCases;
     switch (rt)
     {
         case resultType.Excel:
             testCases = mr.UnmacthedExcel;
             break;
         default:
             testCases = mr.UnmacthedVB;
             break;
     }
     foreach (var merRes in testCases)
     {
         result.Add(new TestCaseRepresentation()
         {
             TestName = merRes.ToString()
         });
     }
     return result;
 }
Пример #6
0
        public void BeforeAll()
        {
            var finder = new DefaultSpecificationFinder(new DefaultFileSystem());
            var expressionRunner = new DefaultExpressionRunnerFactory().CreateExpressionRunner(false);
            var formatter = new SilentConsoleFormatter(new DefaultConsoleWritter());
            runner = new DefaultSpecificationRunner(expressionRunner, finder, formatter);

            var location = new Uri(typeof(TestSpecificationConfigurationManager).Assembly.CodeBase).LocalPath;
            var appDomain = new SpecificationAppDomain(runner);
            var results = appDomain.ExecuteSpecifications(location);
            
            using (var stream = new MemoryStream()) {
                var reporter = new NUnitSpecificationReporter();
                reporter.Write(stream, results);
                stream.Seek(0, SeekOrigin.Begin);

                var serializer = new XmlSerializer(typeof(resultType));
                using (var reader = XmlReader.Create(stream)) {
                    resultType = (resultType)serializer.Deserialize(reader);
                }
            }
        }
        public CustomMessageBox(string messageText, string messageBoxTitle, messageType mType, resultType rType)
        {
            InitializeComponent();

            messageTextBlock.Text = messageText;
            this.Title = messageBoxTitle;
            switch (mType) {
                case messageType.Info:
                    messageIcon.Source = new ImageSourceConverter().ConvertFromString("pack://application:,,,/ACS;component/images/info.png") as ImageSource;
                    break;
                case messageType.Error:
                    messageIcon.Source = new ImageSourceConverter().ConvertFromString("pack://application:,,,/ACS;component/images/error.png") as ImageSource;
                    break;
                case messageType.Warning:
                    messageIcon.Source = new ImageSourceConverter().ConvertFromString("pack://application:,,,/ACS;component/images/Warning.png") as ImageSource;
                    break;
                case messageType.Question:
                    messageIcon.Source = new ImageSourceConverter().ConvertFromString("pack://application:,,,/ACS;component/images/Question.png") as ImageSource;
                    break;
                default:
                    break;
            }

            switch (rType) {
                case resultType.OK:
                    okButton.Visibility = Visibility.Visible;
                    noButton.Visibility = Visibility.Hidden;
                    yesButton.Visibility = Visibility.Hidden;
                    break;
                case resultType.YesNo:
                    okButton.Visibility = Visibility.Hidden;
                    noButton.Visibility = Visibility.Visible;
                    yesButton.Visibility = Visibility.Visible;
                    break;
                default:
                    break;
            }
        }
Пример #8
0
        public void BeforeAll()
        {
            var finder           = new DefaultSpecificationFinder(new DefaultFileSystem());
            var expressionRunner = new DefaultExpressionRunnerFactory().CreateExpressionRunner(false);
            var formatter        = new SilentConsoleFormatter(new DefaultConsoleWritter());

            runner = new DefaultSpecificationRunner(expressionRunner, finder, formatter);

            var location  = new Uri(typeof(TestSpecificationConfigurationManager).Assembly.CodeBase).LocalPath;
            var appDomain = new SpecificationAppDomain(runner);
            var results   = appDomain.ExecuteSpecifications(location);

            using (var stream = new MemoryStream()) {
                var reporter = new NUnitSpecificationReporter();
                reporter.Write(stream, results);
                stream.Seek(0, SeekOrigin.Begin);

                var serializer = new XmlSerializer(typeof(resultType));
                using (var reader = XmlReader.Create(stream)) {
                    resultType = (resultType)serializer.Deserialize(reader);
                }
            }
        }
Пример #9
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="EventResultDTO" /> class
 /// </summary>
 /// <param name="result">The result</param>
 public EventResultDTO(resultType result)
 {
     HomeScore   = result.home_score;
     AwayScore   = result.away_score;
     MatchStatus = result.match_status_code;
 }
Пример #10
0
        public CustomMessageBox(string messageText, string messageBoxTitle, messageType mType, resultType rType)
        {
            InitializeComponent();

            messageTextBlock.Text = messageText;
            this.Title            = messageBoxTitle;
            switch (mType)
            {
            case messageType.Info:
                messageIcon.Source = new ImageSourceConverter().ConvertFromString("pack://application:,,,/ACS;component/images/info.png") as ImageSource;
                break;

            case messageType.Error:
                messageIcon.Source = new ImageSourceConverter().ConvertFromString("pack://application:,,,/ACS;component/images/error.png") as ImageSource;
                break;

            case messageType.Warning:
                messageIcon.Source = new ImageSourceConverter().ConvertFromString("pack://application:,,,/ACS;component/images/Warning.png") as ImageSource;
                break;

            case messageType.Question:
                messageIcon.Source = new ImageSourceConverter().ConvertFromString("pack://application:,,,/ACS;component/images/Question.png") as ImageSource;
                break;

            default:
                break;
            }

            switch (rType)
            {
            case resultType.OK:
                okButton.Visibility  = Visibility.Visible;
                noButton.Visibility  = Visibility.Hidden;
                yesButton.Visibility = Visibility.Hidden;
                break;

            case resultType.YesNo:
                okButton.Visibility  = Visibility.Hidden;
                noButton.Visibility  = Visibility.Visible;
                yesButton.Visibility = Visibility.Visible;
                break;

            default:
                break;
            }
        }
Пример #11
0
 private void DeserializeStream(Stream stream)
 {
     var serializer = new XmlSerializer(typeof(resultType));
     _nativeResult = (resultType)serializer.Deserialize(stream);
 }
Пример #12
0
 private void DeserializeDocument(XmlDocument document)
 {
     var reader = new XmlNodeReader(document.DocumentElement);
     var serializer = new XmlSerializer(typeof(resultType));
     _nativeResult = (resultType)serializer.Deserialize(reader);
 }
Пример #13
0
 public RayFanResult(List <Vector2> pathSoFar, NextRayFanData next, resultType result)
 {
     this.pathSoFar = pathSoFar;
     this.next      = next;
     this.result    = result;
 }
Пример #14
0
type.Result = typeMap.CxTypeToType(resultType, cursor);