Exemplo n.º 1
0
        public void ExportProviderWithReexportTest()
        {
            var exportProvider = new ActionExportProvider(true);

            Assert.True(exportProvider.TryExport(typeof(int), null, 123));
            Assert.True(exportProvider.TryExport(typeof(int), null, 321));

            Assert.Equal(321, exportProvider.GetExport(typeof(int), null));
        }
Exemplo n.º 2
0
        public void ExportProviderWithNamedExportsTest()
        {
            var exportProvider = new ActionExportProvider(false);

            Assert.True(exportProvider.TryExport(typeof(string), null, "TEST"));
            Assert.True(exportProvider.TryExport(typeof(string), "STRING_EXPORT", "TEST2"));
            Assert.True(exportProvider.TryExport(typeof(int), "INT_EXPORT", 123));
            Assert.True(exportProvider.TryExport(typeof(int), "INT_EXPORT2", 321));

            Assert.Equal("TEST", exportProvider.GetExport(typeof(string), null));
            Assert.Equal("TEST2", exportProvider.GetExport(typeof(string), "STRING_EXPORT"));
            Assert.Equal(123, exportProvider.GetExport(typeof(int), "INT_EXPORT"));
            Assert.Equal(321, exportProvider.GetExport(typeof(int), "INT_EXPORT2"));
            Assert.Null(exportProvider.GetExport(typeof(int), null));
        }