次のコードを宣言的な方法で表現するのに問題があります。
[Theory]
[InlineData(@"-o=C:\Temp\someFile -p=1")]
[InlineData(@"-p=1 -o=C:\Temp\someFile")]
public void ParseMissingParameterShouldReturnCorrectResult(
string argsString
)
{
.....
var fixture = new Fixture();
fixture.Register<IFoo>(fixture.Create<Foo>);
fixture.Register<IBar>(fixture.Create<Bar>);
var sut = fixture.Create<SomeClass>();
.....
}
私の生産コードでは、次のようなものがあります。
new SomeClass(new Foo(new Bar))
SomeClass のコンストラクターは次のように定義されています。
public SomeClass(IFoo foo)
ティア、
デビッド
編集:
一部のクラスは次のようになります
public class SomeClass : IQux
{
private readonly IFoo _foo;
public SomeClass(IFoo foo)
{
_foo= foo;
}