Exemple #1
0
        public void Parse_WhenDisabled_DoesNotModifyResults()
        {
            settingsMock.Enabled.Returns(false);

            var expected = new ParseResults(downloadDateTime, null, null);

            innerServiceMock.Parse(FilePayload).Returns(expected);

            ParseResults actual = systemUnderTest.Parse(FilePayload);

            Assert.That(actual, Is.EqualTo(expected));
        }
Exemple #2
0
        public ParseResults ValidateFile(FilePayload filePayload)
        {
            fileCompressionService.DecompressFile(filePayload.DownloadFilePath,
                                                  filePayload.DecompressedDownloadFilePath);
            fileReaderService.ReadFile(filePayload);
            ParseResults parseResults = statsFileParserService.Parse(filePayload);

            filePayload.FileUtcDateTime = parseResults.DownloadDateTime;
            return(parseResults);
        }
        public ParseResults Parse(FilePayload filePayload)
        {
            ParseResults results = innerService.Parse(filePayload);

            if (settingsService.IsOneHundredUsersFilterEnabled())
            {
                return(new ParseResults(results.DownloadDateTime, results.UsersData.Take(100), results.FailedUsersData));
            }

            return(results);
        }
        public ParseResults Parse(FilePayload filePayload)
        {
            ParseResults results = innerService.Parse(filePayload);

            if (settings.Enabled)
            {
                return(new ParseResults(results.DownloadDateTime,
                                        results.UsersData.Where(data => !string.IsNullOrWhiteSpace(data.Name)), results.FailedUsersData));
            }

            return(results);
        }
        public ParseResults Parse(FilePayload filePayload)
        {
            ParseResults results = innerService.Parse(filePayload);

            if (settings.Enabled)
            {
                return(new ParseResults(results.DownloadDateTime, results.UsersData.Where(data => data.TotalPoints > 0),
                                        results.FailedUsersData));
            }

            return(results);
        }
Exemple #6
0
        public void ValidateFile_WhenInvoked_ValidatesFile()
        {
            systemUnderTest.ValidateFile(filePayloadMock);

            Received.InOrder(() =>
            {
                fileCompressionServiceMock
                .Received(1).DecompressFile("DownloadFilePath", "DecompressedDownloadFilePath");
                fileReaderServiceMock.Received(1).ReadFile(filePayloadMock);
                statsFileParserServiceMock.Parse(filePayloadMock);
            });
        }
Exemple #7
0
        public ParseResults Parse(FilePayload filePayload)
        {
            ParseResults results = innerService.Parse(filePayload);

            if (settings.Enabled)
            {
                return(new ParseResults(results.DownloadDateTime,
                                        results.UsersData.Where(data =>
                                                                !data.Name?.StartsWith("google", StringComparison.OrdinalIgnoreCase) ?? true),
                                        results.FailedUsersData));
            }

            return(results);
        }