public void ConvertTo ()
{
ReferenceConverter converter = new ReferenceConverter (typeof(ITestInterface));
string referenceName = "reference name";
Assert.AreEqual ("(none)", (string)converter.ConvertTo (null, null, null, typeof(string)), "#1");
TestComponent component = new TestComponent();
// no context
Assert.AreEqual (String.Empty, (string)converter.ConvertTo (null, null, component, typeof(string)), "#2");
// context with IReferenceService
TestReferenceService referenceService = new TestReferenceService ();
referenceService.AddReference (referenceName, component);
TestTypeDescriptorContext context = new TestTypeDescriptorContext (referenceService);
Assert.AreEqual (referenceName, (string)converter.ConvertTo (context, null, component, typeof(string)), "#3");
// context with Component without IReferenceService
Container container = new Container ();
container.Add (component, referenceName);
context = new TestTypeDescriptorContext ();
context.Container = container;
Assert.AreEqual (referenceName, (string)converter.ConvertTo (context, null, component, typeof(string)), "#4");
}