private IProgramsUnitOfWork GetUnit(List <ProgramUpdatePackageInfo> list, List <TelimenaPackageInfo> toolkitPackages = null)
        {
            UpdatePackageRepository  pkgRepo    = new UpdatePackageRepository(this.Context, new AssemblyStreamVersionReader());
            ProgramRepository        prgRepo    = new ProgramRepository(this.Context);
            ProgramPackageRepository prgPkgRepo = new ProgramPackageRepository(this.Context, new AssemblyStreamVersionReader());

            prgPkgRepo.Add(new ProgramPackageInfo("Prg.zip", this.Prg_1, "1.0.0.0", 2222, "1.0.0.0"));
            prgRepo.Add(new Program("prg", this.Program1Key)
            {
                Id = this.Prg_1
            });

            Mock <IAssemblyStreamVersionReader> reader = TestingUtilities.GetMockVersionReader();

            this.AddToolkits(reader.Object, toolkitPackages);

            foreach (ProgramUpdatePackageInfo programUpdatePackageInfo in list)
            {
                pkgRepo.Add(programUpdatePackageInfo);
            }

            this.Context.SaveChanges();



            ProgramsUnitOfWork unit = new ProgramsUnitOfWork(this.Context, reader.Object);

            return(unit);
        }
        public void NoPackagesAvailable_ShouldNotThrowErrors()
        {
            ProgramRepository prgRepo = new ProgramRepository(this.Context);

            prgRepo.Add(new Program("prg", this.Program1Key)
            {
                Id = this.Prg_1
            });
            this.Context.SaveChanges();
            IProgramsUnitOfWork unit = new ProgramsUnitOfWork(this.Context, TestingUtilities.GetMockVersionReader().Object);

            ProgramsController sut     = new ProgramsController(unit, new Mock <IFileSaver>().Object, new Mock <IFileRetriever>().Object);
            UpdateRequest      request = new UpdateRequest(this.Program1Key, new VersionData("", "1.2.0.0"), this.User1Guid, false, "0.7.0.0", "1.0.0.0");

            UpdateResponse result = sut.UpdateCheck(request).GetAwaiter().GetResult();

            Assert.AreEqual(0, result.UpdatePackages.Count());
            Assert.IsNull(result.Exception);
        }