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

ComposablePartTests.cs « Composition « ComponentModel « System « ComponentModelUnitTest « Tests « System.ComponentModel.Composition « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bab987db6f386adaf54fc783f8e880a676d64842 (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
43
// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Factories;
using System.Linq;
using System.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace System.ComponentModel.Composition
{
    [TestClass]
    public class ComposablePartTests
    {
        [TestMethod]
        public void Constructor1_ShouldSetMetadataPropertyToEmptyDictionary()
        {
            var part = PartFactory.Create();

            EnumerableAssert.IsEmpty(part.Metadata);
        }

        [TestMethod]
        public void Constructor1_ShouldSetMetadataPropertyToReadOnlyDictionary()
        {
            var part = PartFactory.Create();

            ExceptionAssert.Throws<NotSupportedException>(() =>
            {
                part.Metadata["Value"] = "Value";
            });
        }

        [TestMethod]
        public void OnComposed_DoesNotThrow()
        {
            var part = PartFactory.Create();
            part.Activate();
        }

    }
}