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

ExportMetadataAttributeTests.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: 96ff3292d8f8fcc55fc226578f5cd492cfb73cc2 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
// -----------------------------------------------------------------------
using System;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.UnitTesting;

namespace System.ComponentModel.Composition
{
    [TestClass]
    public class ExportMetadataAttributeTests
    {
        [TestMethod]
        public void Constructor_NullAsNameArgument_ShouldSetNamePropertyToEmptyString()
        {
            var attribute = new ExportMetadataAttribute((string)null, "Value");

            Assert.AreEqual(string.Empty, attribute.Name);
        }

        [TestMethod]
        public void Constructor_ShouldSetIsMultiplePropertyToFalse()
        {
            var attribute = new ExportMetadataAttribute("Name", "Value");

            Assert.IsFalse(attribute.IsMultiple);
        }

        [TestMethod]
        public void Constructor_ValueAsNameArgument_ShouldSetNameProperty()
        {
            var expectations = Expectations.GetMetadataNames();
            
            foreach (var e in expectations)
            {
                var attribute = new ExportMetadataAttribute(e, "Value");

                Assert.AreEqual(e, attribute.Name);                
            }
        }

        [TestMethod]
        public void Constructor_ValueAsValueArgument_ShouldSetValueProperty()
        {
            var expectations = Expectations.GetMetadataValues();
            
            foreach (var e in expectations)
            {
                var attribute = new ExportMetadataAttribute("Name", e);

                Assert.AreEqual(e, attribute.Value);
            }
        }

        [TestMethod]
        public void IsMultiple_ValueAsValueArgument_ShouldSetPropert()
        {
            var expectations = Expectations.GetBooleans();

            var attribute = new ExportMetadataAttribute("Name", "Value");

            foreach (var e in expectations)
            {
                attribute.IsMultiple = e;
                Assert.AreEqual(e, attribute.IsMultiple);
            }
        }
    }
}