コード例 #1
0
        public void MMSavedVariableReader_GetEsoGuildStoreSales_GuildTimestampFilter()
        {
            for (int i = 0; i < 16; i++)
            {
                string testFileName = string.Format(TestFilePathFormat, i);
                // Arrange
                var reader = new MMSavedVariableReader(testFileName);
                // Choose a recent enough timestamp that the prefix will have no records with prefixes higher than it.
                // This allows us to do a straight up grep search by timestamp prefix to get the expected count.
                var filter = new EsoSaleFilter
                {
                    GuildName        = "Ethereal Traders Union",
                    TimestampMinimum = 1424900000
                };
                string timestampSubstring = string.Format("[\"timestamp\"] = {0}", filter.TimestampMinimum / 100000);
                string guildSubstring     = string.Format("[\"guild\"] = \"{0}\"", filter.GuildName);
                int    expectedSaleCount  = CountLuaTablesWithLines(testFileName, timestampSubstring, guildSubstring);

                // Act
                // TODO: Performance tune. Possibly ditch full Lua parsing.
                // TODO: Full data file scan is fine to take a long time, but filtered scans should be faster than this currently performs.
                List <EsoSale> sales = reader.GetEsoGuildStoreSales(filter);

                // Assert
                if (expectedSaleCount != sales.Count)
                {
                    Assert.Fail("Expected {0} sales in {1}, but found {2}", expectedSaleCount, testFileName, sales.Count);
                }
            }
        }
コード例 #2
0
        public void MMSavedVariableReader_GetEsoGuildStoreSales_TimestampFilter()
        {
            for (int i = 0; i < 16; i++)
            {
                string testFileName = string.Format(TestFilePathFormat, i);
                // Arrange
                var reader = new MMSavedVariableReader(testFileName);
                // Choose a recent enough timestamp that the prefix will have no records with prefixes higher than it.
                // This allows us to do a straight up grep search by timestamp prefix to get the expected count.
                var filter = new EsoSaleFilter
                {
                    TimestampMinimum = 1424900000
                };
                string searchString      = string.Format("[\"timestamp\"] = {0}", filter.TimestampMinimum / 100000);
                int    expectedSaleCount = CountLuaTablesWithLines(testFileName, searchString);

                // Act
                List <EsoSale> sales = reader.GetEsoGuildStoreSales(filter);

                // Assert
                if (expectedSaleCount != sales.Count)
                {
                    Assert.Fail("Expected {0} sales in {1}, but found {2}", expectedSaleCount, testFileName, sales.Count);
                }
            }
        }