private TImportFile IntermediateFactory <TImportFile>(string contents) where TImportFile : ImportFileBase, IConstructible <ImportFileInitializationParams>, new() { var parameters = new ImportFileInitializationParams(contents); return(StaticInterfaceFactory.Create <TImportFile, ImportFileInitializationParams>(parameters)); }
public void CreateGeneric_AnyParam_ReturnsInstanceOfType_IfInitializationSucceeds() { // Arrange & Act ConstructibleFromParamArray result = StaticInterfaceFactory.Create <ConstructibleFromParamArray>(2); // Assert Assert.IsInstanceOfType(result, typeof(ConstructibleFromParamArray)); Assert.AreEqual(2, result.Number); }
public void CreateNonGeneric_AnyParam_ReturnsInstanceOfType_IfInitializationSucceeds2() { // Arrange & Act IConstructible <int> result = StaticInterfaceFactory <int> .Create(typeof(ConstructibleFromInt), 2); // Assert Assert.IsInstanceOfType(result, typeof(ConstructibleFromInt)); Assert.AreEqual(2, ((ConstructibleFromInt)result).Number); }
public void Create_AnyParam_ThrowsException_IfInitializationFails() { // Arrange, Act & Assert StaticInterfaceFactory.Create <ConstructibleFromParamArray>(null); }