Example #1
0
        protected void SetupTestData(string resourceLocation)
        {
            var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceLocation);

            if (stream == null)
            {
                throw new Exception(string.Format("Unable to load resource \"{0}\"", resourceLocation));
            }

            ImageMemoryStream = new MemoryStream();
            stream.CopyTo(ImageMemoryStream);
            var fileContent = ImageMemoryStream.AsString();

            var fileExtension = Path.GetExtension(resourceLocation) ?? string.Empty;
            var fileName      = Path.GetFileNameWithoutExtension(resourceLocation);
            var path          = Path.GetFullPath(resourceLocation);

            var partitionMetaDataTable = new PartitionMetadataTable(ExhibitConnectionString);

            PartitionMetaDataId = partitionMetaDataTable.InsertPartitionMetadata(ExhibitId, MediaId);

            FileId = new FileMetadataTable(ExhibitConnectionString).InsertFileMetaData(ExhibitId, fileName, fileExtension.TrimStart('.'), fileContent, PartitionMetaDataId, path);
            FileContent.InsertFileContent(ExhibitId, FileId, fileContent, fileExtension);

            CategoryId = new FileCategoryTable(FileSignatureConnectionString).GetCategoryIdByFileCategoryCode("IMAGE");
        }
        public void AssertNumberOfRows(int exhibitId, int expectedValue)
        {
            var actualNumberOfRowsInPartitionMetadataTable = new PartitionMetadataTable(ConnectionString).GetNumberOfRows(exhibitId);

            Console.WriteLine("PARTITION ROWS NUMBER:" + actualNumberOfRowsInPartitionMetadataTable + ". Exhibit id is " + exhibitId);

            Assert.True(actualNumberOfRowsInPartitionMetadataTable.Equals(expectedValue),
                        "The number of rows in PartitionMetadata table is not equal to the expected number. Expected: " +
                        expectedValue + ", but was: " + actualNumberOfRowsInPartitionMetadataTable);
        }