public void ComputeWithUpperAndLowerCase() { var calculator = new OverlapCalculator("cocaCoLa", false); var result = calculator.Compute(); var expected = new int[] { 0, 0, 1, 0, 1, 2, 0, 0 }; CollectionAssert.AreEqual(expected, result); }
public void ComputeMatchedOverlaps() { var calculator = new OverlapCalculator("ATTATACA", true); var result = calculator.Compute(); var expected = new int[] { 0, 0, 0, 1, 2, 1, 0, 1 }; CollectionAssert.AreEqual(expected, result); }
public void ComputeNoMatchingOverlaps() { var calculator = new OverlapCalculator("abdeft", true); var result = calculator.Compute(); var expected = new int[] { 0, 0, 0, 0, 0, 0 }; CollectionAssert.AreEqual(expected, result); }
public static void Main() { // Add the calculation algorithm defined below. OverlapCalculator.AddCalculation <Rectangle, Triangle>(IsOverlapping); var rect = new Rectangle(); var triangle = new Triangle(); var circle = new Circle(); // These will work since we have a two way calculation for Rectangle and Triangle rect.IsOverlapping(triangle); triangle.IsOverlapping(rect); // This will throw since we have no calculation between Circle and Triangle. circle.IsOverlapping(triangle); }
public void CalculateReturnsCorrectValues(int[] dataset1, int[] dataset2, int expectedTotal, int expectedDistinct) { // Given var keyCounts1 = CreateKeyCounter(dataset1); var keyCounts2 = CreateKeyCounter(dataset2); var calculator = new OverlapCalculator <int>(); // When var overlap = calculator.Calculate(keyCounts1, keyCounts2); // Then Assert.Equal(expectedTotal, overlap.TotalCount); Assert.Equal(expectedDistinct, overlap.DistinctCount); }
public void NullablePattern() { var calculator = new OverlapCalculator(null); }
public void EmptyPattern() { var calculator = new OverlapCalculator(""); }