Files
mono/mcs/class/System.ComponentModel.Composition/Tests/ComponentModelUnitTest/System/ComponentModel/Composition/ComposablePartTests.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

43 lines
1.2 KiB
C#

// -----------------------------------------------------------------------
// 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();
}
}
}