Skip to content
Prev Previous commit
Next Next commit
Fix Build Errors
  • Loading branch information
SureshRepos committed Feb 4, 2024
commit 855f452c75c29b590e143350b706bb4e0041d33d
4 changes: 3 additions & 1 deletion Algorithms.Tests/Graph/FloydWarshallTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public void CorrectMatrixTest()

var floydWarshaller = new FloydWarshall<int>();

floydWarshaller.Run(graph).Should().Equal(actualDistances);
//floydWarshaller.Run(graph).Should().Equals(actualDistances);
floydWarshaller.Run(graph).Should().BeEquivalentTo(actualDistances);//Post update change

}
}
30 changes: 17 additions & 13 deletions Algorithms.Tests/Knapsack/BranchAndBoundKnapsackSolverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public static class BranchAndBoundKnapsackSolverTests
public static void BranchAndBoundTest_Example1_Success()
{
// Arrange
var items = new[] {'A', 'B', 'C', 'D'};
var values = new[] {18, 20, 14, 18};
var weights = new[] {2, 4, 6, 9};
var items = new[] { 'A', 'B', 'C', 'D' };
var values = new[] { 18, 20, 14, 18 };
var weights = new[] { 2, 4, 6, 9 };

var capacity = 15;

Expand All @@ -25,16 +25,18 @@ public static void BranchAndBoundTest_Example1_Success()
var actualResult = solver.Solve(items, capacity, weightSelector, valueSelector);

// Assert
actualResult.Should().BeEquivalentTo('A', 'B', 'D');
//actualResult.Should().BeEquivalentTo('A', 'B', 'D');
actualResult.Should().BeEquivalentTo(new[] { 'A', 'B', 'D' });//Post update change

}

[Test]
public static void BranchAndBoundTest_Example2_Success()
{
// Arrange
var items = new[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};
var items = new[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J' };
var values = new[] { 505, 352, 458, 220, 354, 414, 498, 545, 473, 543 };
var weights = new[] {23, 26, 20, 18, 32, 27, 29, 26, 30, 27};
var weights = new[] { 23, 26, 20, 18, 32, 27, 29, 26, 30, 27 };

var capacity = 67;

Expand All @@ -46,16 +48,18 @@ public static void BranchAndBoundTest_Example2_Success()
var actualResult = solver.Solve(items, capacity, weightSelector, valueSelector);

// Assert
actualResult.Should().BeEquivalentTo('H', 'D', 'A');
//actualResult.Should().BeEquivalentTo('H', 'D', 'A');
actualResult.Should().BeEquivalentTo(new[] { 'H', 'D', 'A' });// Post update change

}

[Test]
public static void BranchAndBoundTest_CapacityIsZero_NothingTaken()
{
// Arrange
var items = new[] {'A', 'B', 'C', 'D'};
var values = new[] {18, 20, 14, 18};
var weights = new[] {2, 4, 6, 9};
var items = new[] { 'A', 'B', 'C', 'D' };
var values = new[] { 18, 20, 14, 18 };
var weights = new[] { 2, 4, 6, 9 };

var capacity = 0;

Expand All @@ -74,9 +78,9 @@ public static void BranchAndBoundTest_CapacityIsZero_NothingTaken()
public static void BranchAndBoundTest_PlentyCapacity_EverythingIsTaken()
{
// Arrange
var items = new[] {'A', 'B', 'C', 'D'};
var values = new[] {18, 20, 14, 18};
var weights = new[] {2, 4, 6, 9};
var items = new[] { 'A', 'B', 'C', 'D' };
var values = new[] { 18, 20, 14, 18 };
var weights = new[] { 2, 4, 6, 9 };

var capacity = 1000;

Expand Down
13 changes: 10 additions & 3 deletions Utilities.Tests/Extensions/DictionaryExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ public void AddMany_ShouldAddAllKeyValuePairs()

dictionary.Should().HaveCount(3);

dictionary.Should().ContainKey("one").WhichValue.Should().Be(1);
dictionary.Should().ContainKey("two").WhichValue.Should().Be(2);
dictionary.Should().ContainKey("three").WhichValue.Should().Be(3);

// dictionary.Should().ContainKey("one").WhichValue.Should().Be(1);
// dictionary.Should().ContainKey("two").WhichValue.Should().Be(2);
// dictionary.Should().ContainKey("three").WhichValue.Should().Be(3);

//Change after Fluent Assertions updated to 6.*
dictionary.Should().ContainKey("one");
dictionary.Should().ContainKey("two");
dictionary.Should().ContainKey("three");

}
}