public void SetUp()
        {
            m_RefPoolService = new RefPoolService();
            var configReader = Substitute.For <IRefPoolServiceConfigReader>();

            configReader.DefaultCapacity.Returns(1);
            m_RefPoolService.ConfigReader = configReader;
            m_RefPoolService.OnInit();
        }
        public void SetUp()
        {
            if (Directory.Exists(SavePathRoot))
            {
                Directory.Delete(SavePathRoot, true);
            }

            if (!Directory.Exists(SavePathRoot))
            {
                Directory.CreateDirectory(SavePathRoot);
            }

            m_DirectoryInfo = new DirectoryInfo(SavePathRoot);

            m_TickService = new MockTickService();

            m_RefPoolService = new RefPoolService();
            var refPoolServiceConfigReader = Substitute.For <IRefPoolServiceConfigReader>();

            refPoolServiceConfigReader.DefaultCapacity.Returns(1);
            m_RefPoolService.ConfigReader = refPoolServiceConfigReader;
            m_RefPoolService.OnInit();

            m_DownloadService = new DownloadService {
                TickService = m_TickService, TickOrder = 0
            };
            var configReader = Substitute.For <IDownloadServiceConfigReader>();

            configReader.TempFileExtension.Returns(".tmp");
            configReader.Timeout.Returns(1f);
            configReader.ChunkSizeToSave.Returns(32);
            configReader.ConcurrentDownloadCountLimit.Returns(2);
            m_DownloadService.ConfigReader = configReader;

            m_DownloadTaskImplFactory = new MockDownloadTaskImplFactory();
            var mockDownloadTaskImplFactory = m_DownloadTaskImplFactory as MockDownloadTaskImplFactory;

            mockDownloadTaskImplFactory.TaskShouldNeverStart = false;

            m_DownloadService.RefPoolService          = m_RefPoolService;
            m_DownloadService.DownloadTaskImplFactory = m_DownloadTaskImplFactory;
            m_DownloadService.OnInit();
        }
예제 #3
0
        public void SetUp()
        {
            m_TickService    = new MockTickService();
            m_RefPoolService = new RefPoolService();
            var refPoolServiceConfigReader = Substitute.For <IRefPoolServiceConfigReader>();

            refPoolServiceConfigReader.DefaultCapacity.Returns(1);
            m_RefPoolService.ConfigReader = refPoolServiceConfigReader;
            m_RefPoolService.OnInit();
            m_DownloadService = new DownloadService {
                TickService = m_TickService, TickOrder = 0
            };
            var configReader = Substitute.For <IDownloadServiceConfigReader>();

            configReader.TempFileExtension.Returns(".tmp");
            configReader.Timeout.Returns(10000f);
            configReader.ChunkSizeToSave.Returns(1024);
            configReader.ConcurrentDownloadCountLimit.Returns(2);
            m_DownloadService.ConfigReader   = configReader;
            m_DownloadService.RefPoolService = m_RefPoolService;
            m_DownloadService.OnInit();
        }