Exemple #1
0
        public void AddLessThanMaxCapacity_CountMatchesCountOfInsertedValues()
        {
            var collection = new DistinctMaxStack <int>(3);

            collection.Push(1);
            collection.Push(2);

            collection.Count.Should().Be(2);
        }
Exemple #2
0
        public void AddMoreThanMaxCapacity_SizeIsNotIncreased()
        {
            var collection = new DistinctMaxStack <int>(3);

            collection.Push(1);
            collection.Push(2);
            collection.Push(3);
            collection.Push(4);

            collection.Count.Should().Be(3);
        }
Exemple #3
0
 public Configuration(ConfigurationDto configurationDto, IFileService fileService)
 {
     _fileService             = fileService;
     _historyTargetPaths      = new DistinctMaxStack <string>(7, configurationDto.HistoryTargetPaths);
     _historySourcePaths      = new DistinctMaxStack <string>(7, configurationDto.HistorySourcePaths);
     _historyPathFormats      = new DistinctMaxStack <string>(7, configurationDto.HistoryPathFormats);
     _historyFileNamePrefixes = new DistinctMaxStack <string>(7, configurationDto.HistoryFileNamePrevixes);
     OverrideStrategy         = configurationDto.OverrideStrategy;
     PathFormat     = HistoryPathFormats.FirstOrDefault();
     FileNamePrefix = HistoryFileNamePrefixes.FirstOrDefault();
 }
Exemple #4
0
        public void PushTwoOverLimit_RemoveFirstTwoInserted()
        {
            var collection = new DistinctMaxStack <int>(3);

            collection.Push(1);
            collection.Push(2);
            collection.Push(3);
            collection.Push(4);
            collection.Push(5);

            var expectedCollection = new[] { 5, 4, 3 };

            collection.Should().BeEquivalentTo(expectedCollection);
        }