Exemple #1
0
        public IExercise CreateDomainExercise(Exercises exercise)
        {
            // Setup
            IExercise dExercise = new Exercise();

            // Convert
            // :Exercise
            dExercise.ID = exercise.idExercises;
            dExercise.ExerciseStart = exercise.ExerciseStart;
            dExercise.ExerciseEnd = exercise.ExerciseEnd;

            // :Points
            foreach (var point in exercise.RoutePoints)
            {
                dExercise.AddPoint(point.Latitude, point.Longitude, point.Time);
            }

            return dExercise;
        }
Exemple #2
0
        // Functions
        // :IExerciseFactory
        public Exercises CreateDBExercise(IExercise exercise)
        {
            // Setup
            Exercises createdExercise = new Exercises();

            // Convert
            // :Exercise
            createdExercise.RoutePoints = new ObservableCollection<RoutePoints>();
            createdExercise.ExerciseStart = exercise.ExerciseStart;
            createdExercise.ExerciseEnd = exercise.ExerciseEnd;

            // :Points
            foreach (var point in exercise.Points)
            {
                var createdPoint = new RoutePoints();
                createdPoint.Latitude = point.Latitude;
                createdPoint.Longitude = point.Longitude;
                createdPoint.Time = point.Time;

                createdExercise.RoutePoints.Add(createdPoint);
            }

            return (createdExercise);
        }
Exemple #3
0
        public void FirstNotRepeatedCharWhenNullStringShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.FirstNotRepeatedChar(null));
        }
Exemple #4
0
        public void SudokuCheckerWhenNullArrayShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.SudokuChecker(null));
        }
Exemple #5
0
        public void MostRepeatedWordWhenNullShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.MostRepeatedWord(null));
        }
Exemple #6
0
        public void GetMaxScoresWhenNullSequenceShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.GetMaxScores(null));
        }
Exemple #7
0
        public void GetMaxScoresWhenEmptySequenceShouldReturnEmptySequence()
        {
            Exercises testExercise = new Exercises();

            Assert.Empty(testExercise.GetMaxScores(new List <TestResults>()));
        }
Exemple #8
0
        public void MergeProductListsWhenBothSequencesEmptyShouldReturnEmptySequence()
        {
            Exercises testExercise = new Exercises();

            Assert.Empty(testExercise.MergeProductLists(new List <Product>(), new List <Product>()));
        }
Exemple #9
0
        public void NumberOfLettersWhenNoEmptyStringShouldReturnNumberOfConsonantsAndVowels()
        {
            Exercises testExercise = new Exercises();

            Assert.Equal((12, 5), testExercise.NumberOfLetters("This is a test string"));
        }
Exemple #10
0
        public void PalindromeGeneratorWhenEmptyStringShouldReturnEmptySequence()
        {
            Exercises testExercise = new Exercises();

            Assert.Empty(testExercise.PalindromeGenerator(""));
        }
Exemple #11
0
        public void ConvertToIntWhenNullShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.ConvertToInt(null));
        }
Exemple #12
0
        public void ConvertToIntWhenLowerThanIntShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <OverflowException>(() => testExercise.ConvertToInt("-2147483649"));
        }
Exemple #13
0
        public void ConvertToIntWhenInvalidNegativeSymbolShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <FormatException>(() => testExercise.ConvertToInt("1-"));
        }
Exemple #14
0
        public void GivenAString_ManipulateString_ReturnsATransformedString(string original, int num, string expected)
        {
            var result = Exercises.ManipulateString(original, num);

            Assert.AreEqual(expected, result);
        }
Exemple #15
0
 public void GivenAnInvalidDoubleString_ParseNum_ReturnsMinus999()
 {
     Assert.AreEqual(-999, Exercises.ParseNum("twenty-two"));
 }
Exemple #16
0
 public void GivenAString_ParseNum_ReturnsTheDoubleRepresentedByTheString()
 {
     Assert.AreEqual(3.14159, Exercises.ParseNum("3.14159"));
 }
Exemple #17
0
        public void NumberOfLettersWhenOnlyVowelsShouldReturn0ConsonantsAndNumberOfVowels()
        {
            Exercises testExercise = new Exercises();

            Assert.Equal((0, 5), testExercise.NumberOfLetters("a, e, i, o, u!!!."));
        }
Exemple #18
0
        public void PalindromeGeneratorWhenNullStringShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.PalindromeGenerator(null));
        }
Exemple #19
0
        public void NumberOfLettersWhenNullStringShouldReturn0ConsonantsAnd0Vowels()
        {
            Exercises testExercise = new Exercises();

            Assert.Equal((0, 0), testExercise.NumberOfLetters(null));
        }
Exemple #20
0
        public void SubarraysOfKWhenArrayIsEmptyShouldReturnEmptySequence()
        {
            Exercises testExercise = new Exercises();

            Assert.Empty(testExercise.SubarraysOfK(new int[] { }, 9));
        }
Exemple #21
0
        public void FirstNotRepeatedCharWhenEmptyStringShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <InvalidOperationException>(() => testExercise.FirstNotRepeatedChar(""));
        }
Exemple #22
0
        public void SubarraysOfKWhenNullArrayShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.SubarraysOfK(null, 0));
        }
Exemple #23
0
        public void MostRepeatedWordWhenEmptyStringShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <InvalidOperationException>(() => testExercise.MostRepeatedWord(""));
        }
Exemple #24
0
        public void SummationOfNWhenNIsSmallerThan1ShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <InvalidOperationException>(() => testExercise.SummationOfN(0, 0));
        }
Exemple #25
0
        public void FirstNotRepeatedCharWhenNotEmptyStringShouldReturnFirstNotRepeatedChar()
        {
            Exercises testExercise = new Exercises();

            Assert.Equal('h', testExercise.FirstNotRepeatedChar("This Is A Test String!"));
        }
Exemple #26
0
        public void SummationOfNWhenNIsIsHigherThan30ShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <OverflowException>(() => testExercise.SummationOfN(31, 0));
        }
Exemple #27
0
        public void PolishPostfixCalculatorWhenNullShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.PolishPostfixCalculator(null));
        }
Exemple #28
0
        public void PythagoreanCombinationsWhenArrayHasLessThan3ShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <InvalidOperationException>(() => testExercise.PythagoreanCombinations(new[] { 0 }));
        }
Exemple #29
0
        public void ConvertToIntWhenEmptyStringShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <FormatException>(() => testExercise.ConvertToInt(""));
        }
Exemple #30
0
        public void NumberOfLettersWhenOnlyConsonantsShouldReturnNumberOfConsonantsAnd0Vowels()
        {
            Exercises testExercise = new Exercises();

            Assert.Equal((12, 0), testExercise.NumberOfLetters("Ths s tst strng"));
        }
Exemple #31
0
        public void PythagoreanCombinationsWhenNullArrayShouldThrowException()
        {
            Exercises testExercise = new Exercises();

            Assert.Throws <ArgumentNullException>(() => testExercise.PythagoreanCombinations(null));
        }
Exemple #32
0
        public void GivenATestScore_Scorer_ReturnsAFormattedString(int score, int outOf, string expString)
        {
            var result = Exercises.Scorer(score, outOf);

            Assert.AreEqual(expString, result);
        }