public void DefaultAttributeTest() { ExportAttribute attribute = new ExportAttribute(); IEnumerable<string> exportNames = attribute.ProvideExportNames(typeof(BasicService)); Assert.NotNull(exportNames); Assert.Equal(0, exportNames.Count()); }
public void SingleNameAttributeTest() { const string testExport = "TestExport"; ExportAttribute attribute = new ExportAttribute(testExport); IEnumerable<string> exportNames = attribute.ProvideExportNames(typeof(BasicService)); Assert.NotNull(exportNames); Assert.Equal(1, exportNames.Count()); Assert.Equal(testExport, exportNames.First()); }
public void MultipleTypeAttributeTest() { ExportAttribute attribute = new ExportAttribute(typeof(BasicService), typeof(DisposableService)); IEnumerable<Type> exportTypes = attribute.ProvideExportTypes(typeof(BasicService)); Assert.NotNull(exportTypes); Assert.Equal(2, exportTypes.Count()); Assert.Equal(typeof(BasicService), exportTypes.First()); Assert.Equal(typeof(DisposableService), exportTypes.Last()); }
public void NullArgTest() { try { ExportAttribute exportAttribute = new ExportAttribute((string)null); throw new Exception("ExportAttribute should throw exception on null string"); } catch (ArgumentNullException argumentNull) { Assert.NotNull(argumentNull); } try { ExportAttribute exportAttribute = new ExportAttribute((Type)null); throw new Exception("ExportAttribute should throw exception on null string"); } catch (ArgumentNullException argumentNull) { Assert.NotNull(argumentNull); } }