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; }
// 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); }
public void FirstNotRepeatedCharWhenNullStringShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.FirstNotRepeatedChar(null)); }
public void SudokuCheckerWhenNullArrayShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.SudokuChecker(null)); }
public void MostRepeatedWordWhenNullShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.MostRepeatedWord(null)); }
public void GetMaxScoresWhenNullSequenceShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.GetMaxScores(null)); }
public void GetMaxScoresWhenEmptySequenceShouldReturnEmptySequence() { Exercises testExercise = new Exercises(); Assert.Empty(testExercise.GetMaxScores(new List <TestResults>())); }
public void MergeProductListsWhenBothSequencesEmptyShouldReturnEmptySequence() { Exercises testExercise = new Exercises(); Assert.Empty(testExercise.MergeProductLists(new List <Product>(), new List <Product>())); }
public void NumberOfLettersWhenNoEmptyStringShouldReturnNumberOfConsonantsAndVowels() { Exercises testExercise = new Exercises(); Assert.Equal((12, 5), testExercise.NumberOfLetters("This is a test string")); }
public void PalindromeGeneratorWhenEmptyStringShouldReturnEmptySequence() { Exercises testExercise = new Exercises(); Assert.Empty(testExercise.PalindromeGenerator("")); }
public void ConvertToIntWhenNullShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.ConvertToInt(null)); }
public void ConvertToIntWhenLowerThanIntShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <OverflowException>(() => testExercise.ConvertToInt("-2147483649")); }
public void ConvertToIntWhenInvalidNegativeSymbolShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <FormatException>(() => testExercise.ConvertToInt("1-")); }
public void GivenAString_ManipulateString_ReturnsATransformedString(string original, int num, string expected) { var result = Exercises.ManipulateString(original, num); Assert.AreEqual(expected, result); }
public void GivenAnInvalidDoubleString_ParseNum_ReturnsMinus999() { Assert.AreEqual(-999, Exercises.ParseNum("twenty-two")); }
public void GivenAString_ParseNum_ReturnsTheDoubleRepresentedByTheString() { Assert.AreEqual(3.14159, Exercises.ParseNum("3.14159")); }
public void NumberOfLettersWhenOnlyVowelsShouldReturn0ConsonantsAndNumberOfVowels() { Exercises testExercise = new Exercises(); Assert.Equal((0, 5), testExercise.NumberOfLetters("a, e, i, o, u!!!.")); }
public void PalindromeGeneratorWhenNullStringShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.PalindromeGenerator(null)); }
public void NumberOfLettersWhenNullStringShouldReturn0ConsonantsAnd0Vowels() { Exercises testExercise = new Exercises(); Assert.Equal((0, 0), testExercise.NumberOfLetters(null)); }
public void SubarraysOfKWhenArrayIsEmptyShouldReturnEmptySequence() { Exercises testExercise = new Exercises(); Assert.Empty(testExercise.SubarraysOfK(new int[] { }, 9)); }
public void FirstNotRepeatedCharWhenEmptyStringShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <InvalidOperationException>(() => testExercise.FirstNotRepeatedChar("")); }
public void SubarraysOfKWhenNullArrayShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.SubarraysOfK(null, 0)); }
public void MostRepeatedWordWhenEmptyStringShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <InvalidOperationException>(() => testExercise.MostRepeatedWord("")); }
public void SummationOfNWhenNIsSmallerThan1ShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <InvalidOperationException>(() => testExercise.SummationOfN(0, 0)); }
public void FirstNotRepeatedCharWhenNotEmptyStringShouldReturnFirstNotRepeatedChar() { Exercises testExercise = new Exercises(); Assert.Equal('h', testExercise.FirstNotRepeatedChar("This Is A Test String!")); }
public void SummationOfNWhenNIsIsHigherThan30ShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <OverflowException>(() => testExercise.SummationOfN(31, 0)); }
public void PolishPostfixCalculatorWhenNullShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.PolishPostfixCalculator(null)); }
public void PythagoreanCombinationsWhenArrayHasLessThan3ShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <InvalidOperationException>(() => testExercise.PythagoreanCombinations(new[] { 0 })); }
public void ConvertToIntWhenEmptyStringShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <FormatException>(() => testExercise.ConvertToInt("")); }
public void NumberOfLettersWhenOnlyConsonantsShouldReturnNumberOfConsonantsAnd0Vowels() { Exercises testExercise = new Exercises(); Assert.Equal((12, 0), testExercise.NumberOfLetters("Ths s tst strng")); }
public void PythagoreanCombinationsWhenNullArrayShouldThrowException() { Exercises testExercise = new Exercises(); Assert.Throws <ArgumentNullException>(() => testExercise.PythagoreanCombinations(null)); }
public void GivenATestScore_Scorer_ReturnsAFormattedString(int score, int outOf, string expString) { var result = Exercises.Scorer(score, outOf); Assert.AreEqual(expString, result); }