Questo è il mio dad
classeCome configurare il container unity per fornire il valore del costruttore di stringhe?
public class Dad
{
public string Name
{
get;set;
}
public Dad(string name)
{
Name = name;
}
}
Questo è il mio metodo di prova
public void TestDad()
{
UnityContainer DadContainer= new UnityContainer();
Dad newdad = DadContainer.Resolve<Dad>();
newdad.Name = "chris";
Assert.AreEqual(newdad.Name,"chris");
}
Questo è l'errore che sto ottenendo
"InvalidOperationException - the type String cannot be constructed.
You must configure the container to supply this value"
Come faccio a configurare il mio DadContainer
per questo affermazione per passare? Grazie
Dai un'occhiata all'iniezione del costruttore. :) – user1908061