public void DistanceMatrixThrowArgumentNullExceptionItShouldOnDistanceMetric() { collectionSize = 111; generatedDataCollection = new GenerateIdentifiableDataPointCollection(collectionSize); dataCollection = generatedDataCollection.Generate(); Assert.Catch <ArgumentNullException>(() => { new DistanceMatrix(dataCollection, null); }); }
public void DistanceMatrixShouldReturnLargerCorrectDistanceMatrix() { double difference; collectionSize = 111; distanceMetric = new EuclideanMetric(); generatedDataCollection = new GenerateIdentifiableDataPointCollection(collectionSize); dataCollection = generatedDataCollection.Generate(); distanceMatrix = new DistanceMatrix(dataCollection, distanceMetric); expectedMatrix = ExpectedMatrix(); for (int row = 0; row < distanceMatrix.Rows; row++) { for (int col = 0; col < distanceMatrix.Columns; col++) { difference = distanceMatrix[row, col] - expectedMatrix[row, col]; if (!(difference < 0.01 && difference > -0.01 && distanceMatrix[row, col] >= 0)) { Assert.Fail("{0}, row = {1}, col = {2}", difference, row, col); } } } }