Exemple #1
0
        public IDownloadSlotsViewModel CreateDownloadSlotsViewModel(Download download)
        {
            IDownloadSlotsViewModel downloadSlotsViewModel =
                new DownloadSlotsViewModel(download, downloadingClientFactory, fileStreamClientFactory);

            return(downloadSlotsViewModel);
        }
        protected override void Establish_context()
        {
            base.Establish_context();

            DownloadSlotsModel = new Mock <IDownloadSlotsModel>();

            NetworkClientFactory = new Mock <INetworkClientFactory>();
            NetworkClient        = new Mock <INetworkClient>();
            NetworkClientFactory.Setup(clientFactory => clientFactory.CreateClient(It.IsAny <IUriSource>()))
            .Returns(NetworkClient.Object);

            FileStreamClientFactory = new Mock <IFileStreamClientFactory>();
            FileStreamClient        = new Mock <IFileStreamClient>();
            FileStreamClientFactory.Setup(clientFactory => clientFactory.CreateFileStreamClient(It.IsAny <IFilePathSource>()))
            .Returns(FileStreamClient.Object);

            List <DownloadSlot> downloadSlots = this.createDownloadSlots();

            DownloadSlotsModel.SetupGet(slotsModel => slotsModel.DownloadSlots).Returns(downloadSlots);
            DownloadSlotsViewModel = new DownloadSlotsViewModel(DownloadSlotsModel.Object,
                                                                NetworkClientFactory.Object, FileStreamClientFactory.Object);
        }
 public void Then_downloads_in_slots_view_model_should_be_started()
 {
     DownloadSlotsViewModel.Verify(slots => slots.StartDownloading());
 }
 public void Then_downloading_should_be_stopped()
 {
     DownloadSlotsViewModel.Verify(slots => slots.StopDownloading());
 }
 protected override void Because_of()
 {
     DownloadSlotsViewModel.StartDownloading();
 }
 protected override void Because_of()
 {
     DownloadSlotsViewModel.TryInitialize();
 }