Ejemplo n.º 1
0
        public void GetDinstinctIntegers_ShouldReturnUniqueList_WhenPassedDuplicates()
        {
            //Arrange
            var primeNumberCalculator = new PrimeNumberCalculator();
            var input = new Dictionary <string, int> {
                { "you", 22 },
                { "to", 10 },
                { "fro", 10 },
                { "to", 10 },
                { "be", 7 },
                { "to", 7 },
            };
            var expectedOutput = new List <int> {
                12, 10, 7
            };

            //Act
            var actualOutput = primeNumberCalculator.GetDistinctIntegers(input);

            //Assert
            CollectionAssert.AreEquivalent(expectedOutput, actualOutput);
        }
Ejemplo n.º 2
0
        public void GetDinstinctIntegers_ShouldReturnDistinctValues_WhenPassedDictionary()
        {
            //Arrange
            var primeNumberCalculator = new PrimeNumberCalculator();
            var input = new Dictionary <string, int>
            {
                { "foo", 1 },
                { "bar", 1 },
                { "meerkat", 2 },
                { "ivan", 3 },
                { "sergei", 3 }
            };
            var expectedOutput = new List <int> {
                1, 2, 3
            };

            //Act
            var actualOutput = primeNumberCalculator.GetDistinctIntegers(input);

            //Assert
            CollectionAssert.AreEquivalent(expectedOutput, actualOutput);
        }