public void ThenTheNumberOfExpectedConnectionTypeIdEntriesIsCorrectInTable(string p0)
        {
            if (!_processedExhibit)
            {
                ScenarioContext.Current.Pending();
            }

            var expectedConnectionEventDataFilePath = Path.GetFullPath(_settings["ExpectedConnectionEventData"].Value);

            Assert.True(File.Exists(expectedConnectionEventDataFilePath));

            var csvReader = new CsvFileReader(expectedConnectionEventDataFilePath);
            var totalNumberOfRowsInFile = csvReader.GetNumberOfDataRowsOnWorksheet(0);

            var expectedConnectionTypeIdEntriesDictionary   = new Dictionary <int?, int?>();
            var notMachingConnectionTypeIdEntriesDictionary = new Dictionary <int?, List <int?> >();

            for (var i = 0; i < totalNumberOfRowsInFile; i++)
            {
                int?connectionTypeId = csvReader.GetIntValue(i, 0);
                int?numberOfEntries  = csvReader.GetIntValue(i, 1);
                expectedConnectionTypeIdEntriesDictionary.Add(connectionTypeId, numberOfEntries);
            }
            foreach (var connectionEvent in expectedConnectionTypeIdEntriesDictionary)
            {
                int?connectionTypeId     = connectionEvent.Key;
                int?expectedNumberOfRows = connectionEvent.Value;
                int?actualNumberOfRows   = _connectionMetadataTable.CountRowsWithConnectionTypeId(_exhibitId,
                                                                                                  connectionTypeId);

                if (!actualNumberOfRows.Equals(expectedNumberOfRows))
                {
                    notMachingConnectionTypeIdEntriesDictionary.Add(connectionTypeId,
                                                                    new List <int?> {
                        expectedNumberOfRows, actualNumberOfRows
                    });
                }
            }

            Assert.True(notMachingConnectionTypeIdEntriesDictionary.Count.Equals(0),
                        "There were some rows in ConnectionEvent table where the actual number of certain ConnectionTypeId entries is not equal tot he expected one." +
                        "Those ConnectionTypeIds are:\n" + PrintNotMatchingConnectionTypeIdEntriesDictionary(notMachingConnectionTypeIdEntriesDictionary));
        }
        public void ThenTheNumberOfExpectedEntityNameEntriesIsCorrectInTable(string table)
        {
            {
                if (!_processedExhibit)
                {
                    ScenarioContext.Current.Pending();
                }

                var expectedEntityDataFilePath = Path.GetFullPath(_settings["ExpectedEntityData"].Value);
                Assert.True(File.Exists(expectedEntityDataFilePath));

                var csvReader = new CsvFileReader(expectedEntityDataFilePath);
                var totalNumberOfExpectedEntityNames = csvReader.GetNumberOfDataRowsOnWorksheet(0);

                var expectedEntityNameEntiresDictionary   = new Dictionary <string, int?>();
                var notMachingEntityNameEntriesDictionary = new Dictionary <string, List <int?> >();

                for (var i = 0; i < totalNumberOfExpectedEntityNames; i++)
                {
                    var entityName      = csvReader.GetStringValue(i, 0);
                    int?numberOfEntries = csvReader.GetIntValue(i, 1);
                    expectedEntityNameEntiresDictionary.Add(entityName, numberOfEntries);
                }
                foreach (var entity in expectedEntityNameEntiresDictionary)
                {
                    var entityName           = entity.Key;
                    var expectedNumberOfRows = entity.Value;

                    var actualNumberOfRows = 0;
                    try
                    {
                        var listOfEntitiesWithName = Entity.GetEntity_Name(_exhibitId, entityName);
                        actualNumberOfRows = listOfEntitiesWithName.Count;
                    }
                    catch (Exception)
                    {
                    }

                    if (!actualNumberOfRows.Equals(expectedNumberOfRows))
                    {
                        notMachingEntityNameEntriesDictionary.Add(entityName,
                                                                  new List <int?> {
                            expectedNumberOfRows, actualNumberOfRows
                        });
                    }
                }

                Assert.True(notMachingEntityNameEntriesDictionary.Count.Equals(0),
                            "There were some Entity Names in Entity table where the number of their actual entries" +
                            " do not match the expected one. " +
                            "Those Entity Names are:\n" + PrintNotMatchingEntityNameEntriesDictionary(notMachingEntityNameEntriesDictionary));
            }
        }
        public FileMetadataModel PopulateExpectedFileDetailsDictionary(CsvFileReader csvReader, int rowNumber)
        {
            var expectedDetails = new FileMetadataModel
            {
                FileName         = csvReader.GetStringValue(rowNumber, FileNameColumnNumberInCsvFile),
                FilePath         = csvReader.GetStringValue(rowNumber, FilePathColumnNumberInCsvFile),
                CreatedDate      = csvReader.GetDateTimeValue(rowNumber, CreatedDateColumnNumberInCsvFile),
                LastAccessedDate = csvReader.GetDateTimeValue(rowNumber, LastAccessedDateColumnNumberInCsvFile),
                LastModifiedDate = csvReader.GetDateTimeValue(rowNumber, LastModifiedColumnNumberInCsvFile),
                FileTypeId       = csvReader.GetIntValue(rowNumber, FileTypeColumnNumberInCsvFile),
                FileExtension    = csvReader.GetStringValue(rowNumber, FileExtensionColumnNumberInCsvFile),
                FileSize         = long.Parse(csvReader.GetStringValue(rowNumber, FileSizeColumnNumberInCsvFile))
            };

            return(expectedDetails);
        }