ので(それはどんな違いがあれば、私はxUnitフレームを使用しています)私はTDDをしようとしていると私はテストファイルがあります:あなたが見ることができるように、クラスのカップルがここにあります日時はどこですか?
public class GatheringModuleTests
{
[Fact]
public void GathererGathersSourceCommunications()
{
GatheringClass thing = new GatheringClass(sourceStreamReader, targetStreamReader, ref sourceCommunications, ref targetCommunications);
thing.Process(TimeSpan.FromSeconds(10));
Assert.True(sourceCommunications.Any());
}
}
public class GatheringClass
{
private StreamReader sourceStreamReader;
private StreamReader targetStreamReader;
private List<Communication> sourceCommunications;
private List<Communication> targetCommunications;
public GatheringClass(StreamReader sourceStreamReader, StreamReader targetStreamReader,
ref List<Communication> sourceCommunications, ref List<Communication> targetCommunications)
{
this.sourceStreamReader = sourceStreamReader;
this.targetStreamReader = targetStreamReader;
this.sourceCommunications = sourceCommunications;
this.targetCommunications = targetCommunications;
}
public void Process(TimeSpan timeSpan)
{
var dt = new DateTime();
var line = sourceStreamReader.ReadLine();
var lineArray = line.Split('\0');
var communication = new MatchCommunication();
communication.PublishedDate = DateTime.Now;
}
}
を。私はまた、 "通信"オブジェクトで外部ライブラリを参照しています。 "Process"メソッドを見ると、コンパイラに問題がないダミーのDateTimeがあることがわかります。しかし、通信オブジェクトには、波線を生成しているDateTimeフィールド「PublishedDate」を持っている:
The type 'DateTime' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral...
誰もが何が起こっているとどのようにそれを修正することです教えてもらえますか?
このクラスはコンパイルされません。最後のコード行に ';'がありません。 – DigiFriend
エラーメッセージに不満があるアセンブリへの参照を削除しましたか? – DigiFriend
投稿したコードのどこにでも「オブジェクト」という言葉が表示されません。関連するコードでもう一度お試しいただけますか? – itsme86