public void Init() { queueRepository = A.Fake <IQueueRepository>(); system = A.Fake <IFileSystem>(); provider = A.Fake <ISendingProvider>(); CreateFile(SrcFile1); CreateFile(StreamFile1); fakeStream = new FileStream(StreamFile1, FileMode.Open, FileAccess.Read); queue = new FileTransferQueue(QueueName); queue.Enqueue(new FileItem { DestPath = DestFile1, SrcPath = SrcFile1 }); queue.Enqueue(new FileItem { DestPath = "./1.txt", Identifier = Identifier1 }); queue.Enqueue(new FileItem { DestPath = "./2.txt", Identifier = Identifier2 }); A.CallTo(() => queueRepository.Load(QueueName)).Returns(queue); A.CallTo(() => system.GetStream(A <string> .Ignored)).Returns(fakeStream); A.CallTo(() => provider.Send(A <Stream> .Ignored, A <string> .Ignored)).Returns(true); manager = new FileTransferQueueManager(QueueName, queueRepository, system, provider); manager.NotificationRaised += manager_NotificationRaised; }
/// <summary> /// Initialize the manager /// </summary> public void Init() { fileQueue = queueRepository.Load(queueName); }
public void ShouldInitManagerCallQueueLoading() { manager.Init(); A.CallTo(() => queueRepository.Load(QueueName)).MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => provider.Send(A <Stream> .Ignored, A <string> .Ignored)).MustNotHaveHappened(); }