This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double SumSquaresUsingLinq() | |
{ | |
return numberList.Sum(num => Math.Pow(num, 2)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void ShouldSumTheSquaresOfAllValuesUsingLinqExpression() | |
{ | |
var sum = new SumNumbers(); | |
Assert.AreEqual(1365.0, sum.SumSquaresUsingLinq()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int SumUsingLinq() | |
{ | |
return numberList.Sum(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SumNumbers | |
{ | |
private int[] numberList = {1, 2, 4, 8, 16, 32}; | |
public int SumUsingLinq() | |
{ | |
return numberList.Sum(num => num); | |
} | |
public int SumUsingForeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class SumNumbersTests | |
{ | |
[Test] | |
public void ShouldAddAllValuesUsingForeach() | |
{ | |
var sum = new SumNumbers(); | |
Assert.AreEqual(63, sum.SumUsingForeach()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sum = 0; | |
foreach (int num in numberList) | |
{ | |
sum += num; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int[] numberList = {1, 2, 4, 8, 16, 32}; //sum = 63 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EuclideanDistance : SimilarityScore | |
{ | |
private readonly Reviewer CompareTo; | |
private readonly Reviewer CompareWith; | |
public EuclideanDistance(Reviewer compareTo, Reviewer compareWith) | |
{ | |
CompareTo = compareTo; | |
CompareWith = compareWith; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tmpdir' | |
temp = Dir.tmpdir() | |
puts temp #C:/Users/Robert/AppData/Local/Temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GitHistory | |
attr_reader :test_lines_of_code, :production_lines_of_code, :current_commit_id, :previous_commit_id, :diff, :has_java_or_test_code | |
def initialize(commit_id = nil) | |
@commit_id= commit_id unless commit_id.nil? | |
if commit_id.nil?: | |
getLatestCommit | |
end | |
@has_java_or_test_code = false |