Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ElementAssert.cs « UnitTesting « Composition « ComponentModel « System « UnitTestFramework « Tests « System.ComponentModel.Composition « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8a9a419447511819d5708df911b9b52f6056686d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.Linq;
using System.Linq.Expressions;
using System.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace System.ComponentModel.Composition.UnitTesting
{
    internal static class ElementAssert
    {
        public static void AreEqual(ICompositionElement expected, ICompositionElement actual)
        {
            if (expected == null || actual == null)
            {
                Assert.AreEqual(expected, actual);
                return;
            }

            Assert.AreEqual(expected.DisplayName, actual.DisplayName);
            ElementAssert.AreEqual(expected.Origin, actual.Origin);
        }

        public static void AreEqual(IEnumerable<ICompositionElement> expected, IEnumerable<ICompositionElement> actual)
        {
            Assert.AreEqual(expected.Count(), actual.Count());

            int index = 0;
            foreach (var element in expected)
            {
                AreEqual(element, actual.ElementAt(index));

                index++;
            }
        }
    }
}