Files
mono/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartDefinitionTests.cs
T
Miguel de Icaza e3f39fb13c Add MEF for .NET 4
svn path=/trunk/mcs/; revision=145695
2009-11-09 01:39:41 +00:00

45 lines
1.3 KiB
C#

// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.UnitTesting;
using System.ComponentModel.Composition.Factories;
namespace System.ComponentModel.Composition
{
[TestClass]
public class ComposablePartDefinitionTests
{
[TestMethod]
public void Constructor1_ShouldNotThrow()
{
PartDefinitionFactory.Create();
}
[TestMethod]
public void Constructor1_ShouldSetMetadataPropertyToEmptyDictionary()
{
var definition = PartDefinitionFactory.Create();
EnumerableAssert.IsEmpty(definition.Metadata);
}
[TestMethod]
public void Constructor1_ShouldSetMetadataPropertyToReadOnlyDictionary()
{
var definition = PartDefinitionFactory.Create();
ExceptionAssert.Throws<NotSupportedException>(() =>
{
definition.Metadata["Value"] = "Value";
});
}
}
}