public async Task Index_WhenQueryGivenAndTitleFound_ErrorIsNull()
        {
            // Arrange

            string query = Testing.Helpers.GetRandomString();
            ITorrentFinderResponse serviceResponse = new TitleResponse()
            {
                Media    = new MediaResponse(),
                Torrents = new List <TorrentResponse>()
            };

            torrentFinderHttpServiceMock
            .Setup(x => x.SearchTitle(query))
            .Returns(Task.FromResult(serviceResponse));

            // Act

            var result = (ViewResult)await controller.Index(query);

            var model = (SearchViewModel)result.Model;

            // Assert

            Assert.IsNull(model.ErrorMessage);
        }
        /*[TestCase("CIV_A4P", "", "", "")]
        *  [TestCase("CIV_A0P", "", "", "")]
        *  [TestCase("CIV_A1P", "", "", "")]
        *  [TestCase("CIV_A2P", "", "", "")]
        *  [TestCase("CIV_A3P", "", "", "")]*/
        public void TestReadingTitleBlock(string layoutName, string expectedTitle, string expectedClient, string expectedProject)
        {
            TitleResponse response = RunTest <TitleResponse>(nameof(TestReadingTitleBlockResident), layoutName);

            Assert.AreEqual(expectedTitle, response.Title);
            Assert.AreEqual(expectedClient, response.Client);
        }
        public TitleResponse TestReadingTitleBlockResident(string layoutName)
        {
            using (Transaction trans =
                       Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction())
            {
                Layout target = Application.DocumentManager.MdiActiveDocument.Database.GetLayout(layoutName);

                LayoutSheet   layoutSheet = new LayoutSheet(null, target);
                TitleResponse response    = new TitleResponse()
                {
                    Title         = layoutSheet.TitleBlock.Title,
                    Client        = layoutSheet.TitleBlock.Client,
                    Project       = layoutSheet.TitleBlock.Project,
                    DrawingNumber = layoutSheet.TitleBlock.DrawingNumber,
                    ProjectNumber = layoutSheet.TitleBlock.ProjectNumber,
                    Revision      = layoutSheet.TitleBlock.Revision,
                };

                return(response);
            }
        }
Esempio n. 4
0
        public static void Run()
        {
            // ExStart:1
            CellsApi   cellsApi   = new CellsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String fileName   = "Sample_Test_Book.xls";
            String sheetName  = "Sheet5";
            int    chartIndex = 0;
            String storage    = "";
            String folder     = "";
            Title  body       = new Title();

            body.Text   = "aspose";
            body.Height = 15;

            try
            {
                // Upload source file to aspose cloud storage
                storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));

                // Invoke Aspose.Cells Cloud SDK API to update chart title
                TitleResponse apiResponse = cellsApi.PostWorksheetChartTitle(fileName, sheetName, chartIndex, storage, folder, body);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    Console.WriteLine("Update Chart Title in Excel Worksheet, Done!");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
 public SearchResultViewModel(TitleResponse resp)
 {
     Media    = new MediaViewModel(resp.Media);
     Torrents = resp.Torrents.Select(x => new TorrentViewModel(x));
 }