コード例 #1
0
            public TestContext(TestDirectory testDir)
            {
                var fullPath = Path.Combine(testDir, "project.csproj");
                var rootDir  = Path.GetPathRoot(testDir);
                var dllDir   = Path.Combine(testDir, "bin", "Debug", "net45");
                var dllPath  = Path.Combine(dllDir, "a.dll");

                Directory.CreateDirectory(dllDir);
                Directory.CreateDirectory(Path.Combine(testDir, "obj"));
                File.WriteAllBytes(dllPath, new byte[0]);
                var path = string.Join(".", typeof(PackTaskLogicTests).Namespace, "compiler.resources", "project.assets.json");

                using (var reader = new StreamReader(GetType().GetTypeInfo().Assembly.GetManifestResourceStream(path)))
                {
                    var contents = reader.ReadToEnd();
                    File.WriteAllText(Path.Combine(testDir, "obj", "project.assets.json"), contents);
                }

                TestDir = testDir;
                Request = new PackTaskRequest
                {
                    PackageId      = "SomePackage",
                    PackageVersion = "3.0.0-beta",
                    Authors        = new[] { "NuGet Team", "Unit test" },
                    AllowedOutputExtensionsInPackageBuildOutputFolder        = new[] { ".dll", ".exe", ".winmd", ".json", ".pri", ".xml" },
                    AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder = new[] { ".dll", ".exe", ".winmd", ".json", ".pri", ".xml", ".pdb", ".mdb" },
                    Description = "A test package.",
                    PackItem    = new MSBuildItem("project.csproj", new Dictionary <string, string>
                    {
                        { "RootDir", rootDir },
                        { "Directory", testDir.ToString().Substring(rootDir.Length) },
                        { "FileName", Path.GetFileNameWithoutExtension(fullPath) },
                        { "Extension", Path.GetExtension(fullPath) },
                        { "FullPath", fullPath }
                    }),
                    BuildOutputFolders = new string[] { "lib" },
                    NuspecOutputPath   = "obj",
                    IncludeBuildOutput = true,
                    RestoreOutputPath  = Path.Combine(testDir, "obj"),
                    ContinuePackingAfterGeneratingNuspec = true,
                    TargetFrameworks     = new[] { "net45" },
                    BuildOutputInPackage = new[] { new MSBuildItem(dllPath, new Dictionary <string, string>
                        {
                            { "FinalOutputPath", dllPath },
                            { "TargetFramework", "net45" }
                        }) },
                    Logger = new TestLogger(),
                    SymbolPackageFormat         = "symbols.nupkg",
                    FrameworkAssemblyReferences = new MSBuildItem[] { },
                    FrameworkReferences         = new MSBuildItem[] { },
                };
            }
コード例 #2
0
ファイル: PackageTaskForm.cs プロジェクト: 524300045/pc
        private void BindDgv()
        {
            PackTaskRequest request = new PackTaskRequest();

            request.PageIndex    = paginator.PageNo;
            request.PageSize     = paginator.PageSize;
            request.startTime    = dtBegin.Value.ToString("yyyy-MM-dd HH:mm:ss");
            request.endTime      = dtBegin.Value.ToString("yyyy-MM-dd 23:59:59");
            request.partnerCode  = UserInfo.PartnerCode;
            request.skuCode      = tbName.Text.Trim();
            request.packTaskType = 10;

            if (cbStatus.SelectedIndex == 0)
            {
                request.status = null;
            }
            if (cbStatus.SelectedIndex == 1)
            {
                request.status = 0;
            }
            if (cbStatus.SelectedIndex == 2)
            {
                request.status = 10;
            }

            if (cbStatus.SelectedIndex == 3)
            {
                request.status = 15;
            }

            if (cbStatus.SelectedIndex == 4)
            {
                request.status = 20;
            }

            PackTaskResponse response = client.Execute(request);

            if (!response.IsError)
            {
                if (response.result == null)
                {
                    this.dataGridView1.DataSource = null;

                    return;
                }
                int recordCount = response.pageUtil.totalRow;
                int totalPage;
                if (recordCount % paginator.PageSize == 0)
                {
                    totalPage = recordCount / paginator.PageSize;
                }
                else
                {
                    totalPage = recordCount / paginator.PageSize + 1;
                }

                foreach (PackTask item in response.result)
                {
                    if (item.modelNum > 0)
                    {
                        decimal curValue = item.orderCount / item.modelNum;
                        item.StandNum = (int)curValue;
                    }
                    if (item.orderNum > 0)
                    {
                        item.progressDes = ((item.finishNum / item.orderNum) * 100).ToString() + "%";
                    }
                }
                IPagedList <PackTask> pageList = new PagedList <PackTask>(response.result, recordCount, totalPage);
                sortList = new SortableBindingList <PackTask>(pageList.ContentList);
                this.dataGridView1.DataSource = sortList;
                pageSplit1.Description        = "共查询到" + pageList.RecordCount + "条记录";
                pageSplit1.PageCount          = pageList.PageCount;
                pageSplit1.PageNo             = paginator.PageNo;
                pageSplit1.DataBind();
            }
        }