public void Instantiate_NotImplementingInterface_NotInstantiated() { var factory = new CustomCommandFactoryProxy(); void instantiate() => factory.Instantiate ( Mock.Of <ICustomCommandArgs>(x => x.AssemblyPath == new LiteralScalarResolver <string>(".") && x.TypeName == new LiteralScalarResolver <string>(this.GetType().Name) && x.Parameters == null ) ); Assert.Throws <NBiException>(instantiate); }
public void Instantiate_NotExistingNamespaceType_NotInstantiated() { var factory = new CustomCommandFactoryProxy(); void instantiate() => factory.Instantiate ( Mock.Of <ICustomCommandArgs>(x => x.AssemblyPath == new LiteralScalarResolver <string>(".") && x.TypeName == new LiteralScalarResolver <string>("Namespace.NotExistingType") && x.Parameters == null ) ); Assert.Throws <NBiException>(instantiate); }
public void Instantiate_ConstructorNotFound_NotInstantiated() { var factory = new CustomCommandFactoryProxy(); void instantiate() => factory.Instantiate ( Mock.Of <ICustomCommandArgs>(x => x.AssemblyPath == new LiteralScalarResolver <string>(".") && x.TypeName == new LiteralScalarResolver <string>(typeof(CustomCommandWithMulipleCtors).Name) && x.Parameters == new ReadOnlyDictionary <string, IScalarResolver>(new Dictionary <string, IScalarResolver>() { { "NotExistingParameter", new LiteralScalarResolver <string>("foo") } }) ) ); Assert.Throws <NBiException>(instantiate); }