public void DayTwoTwo_SampleInput_ReturnResult(string[] inp, string expectedAns) { // Act var actualAns = Solutions.DayTwoTwo(inp); // Assert Assert.AreEqual(expectedAns, actualAns); }
public void DayFiveTwo_SampleInput_ReturnResults(string inp, int expectedAns) { // Act var actualAns = Solutions.DayFiveTwo(inp); // Assert Assert.AreEqual(expectedAns, actualAns); }
public void DayOneTwo_SampleInput_ReturnsResult(int[] inp, int expectedAns) { // Act var actualAns = Solutions.DayOneTwo(inp); // Assert Assert.AreEqual(expectedAns, actualAns); }
public void DayThreeOne_SampleInput_ReturnResult(string[] inp, int expectedAns) { // Arrange var puzzleInp = Inputs.GetDayThreeInput(inp); // Act var actualAns = Solutions.DayThreeOne(puzzleInp); // Assert Assert.AreEqual(expectedAns, actualAns); }
public void CheckIfGameLost() { var gridMap = new Grid[3, 3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { gridMap[i, j] = new Grid(); gridMap[i, j].PlayerID = 1; } } Solutions _solutions = new Solutions(); Assert.IsTrue(_solutions.CheckIfGameWon(gridMap)); }
public override void PerformTest() { var ns = ReadStrings().Select(int.Parse); var expected = ReadInt(); var actual = Solutions.CountOdd(ns); if (actual == expected) { Console.WriteLine("PASS"); } else { Console.WriteLine("FAIL"); Console.WriteLine($"ns = {ShowList(ns)}"); Console.WriteLine($"Expected: {expected}"); Console.WriteLine($"Actual: {actual}"); } }
public override void PerformTest() { var recipes = ReadRecipes(); var expected = Read(); try { var actual = Solutions.MostUsedIngredient(recipes); Check(expected, actual); Console.WriteLine("PASS"); } catch (Exception e) { Console.WriteLine("FAIL"); Console.WriteLine($"recipes = {Show(recipes, Show, d => Show<string, int>(d))}"); Console.WriteLine($"Expected: {expected}"); Console.WriteLine($"Error: {e.Message}"); } }
public void CheckComputationsWrongMessageExceptionTest() { var mockcore = new Mock <ClientNodeProcessingModule>(); var mockcreator = new Mock <IMessageArrayCreator>(); var solutionRequest = new SolutionRequest(); Message[] request = new[] { solutionRequest }; mockcreator.Setup(u => u.Create(solutionRequest)).Returns(request); var mockclient = new Mock <IClusterClient>(); var response = new DivideProblem(); var response2 = new Solutions(); var responses = new Message[] { response, response2 }; mockclient.Setup(u => u.SendRequests(request)).Returns(responses); var clientNode = new ClientNode(mockclient.Object, mockcore.Object, mockcreator.Object); var ret = clientNode.CheckComputations(solutionRequest); }
public override void PerformTest() { var recipes = ReadRecipes(); var vegetarianIngredients = ReadStrings(); var expected = ReadStrings(); try { var actual = Solutions.VegetarianRecipes(recipes, vegetarianIngredients); CheckSequence(expected, actual); Console.WriteLine("PASS"); } catch (Exception e) { Console.WriteLine("FAIL"); Console.WriteLine($"recipes = {Show(recipes, Show, d => Show<string, int>(d))}"); Console.WriteLine($"vegetarianIngredients = {Show(vegetarianIngredients)}"); Console.WriteLine($"Expected: {Show(expected)}"); Console.WriteLine($"Error: {e.Message}"); } }
public override void PerformTest() { var recipeIngredients = ReadRecipeIngredients(); var ingredientCosts = ReadIngredientCosts(); var expected = ReadInt(); try { var actual = Solutions.RecipeCost(recipeIngredients, ingredientCosts); Check(expected, actual); Console.WriteLine("PASS"); } catch (Exception e) { Console.WriteLine("FAIL"); Console.WriteLine($"recipeIngredients = {Show(recipeIngredients)}"); Console.WriteLine($"ingredientCosts = {Show(ingredientCosts)}"); Console.WriteLine($"Expected: {expected}"); Console.WriteLine($"Error: {e.Message}"); } }
public override void PerformTest() { var recipes = ReadRecipes(); var stock = ReadStock(); var expected = ReadStrings(); try { var actual = Solutions.CookableRecipes(recipes, stock); CheckSequence(expected, actual); Console.WriteLine("PASS"); } catch (Exception e) { Console.WriteLine("FAIL"); Console.WriteLine($"recipes = {Show(recipes, Show, d => Show<string, int>(d))}"); Console.WriteLine($"stock = {Show(stock)}"); Console.WriteLine($"Expected: {Show(expected)}"); Console.WriteLine($"Error: {e.Message}"); } }
public override void PerformTest() { var recipeIngredients = ReadRecipeIngredients(); var stock = ReadStock(); var expected = ReadBool(); try { var actual = Solutions.EnoughIngredients(recipeIngredients, stock); Check(expected, actual); Console.WriteLine("PASS"); } catch (Exception e) { Console.WriteLine("FAIL"); Console.WriteLine($"recipeIngredients = {Show(recipeIngredients)}"); Console.WriteLine($"stock = {Show(stock)}"); Console.WriteLine($"Expected: {expected}"); Console.WriteLine($"Error: {e.Message}"); } }
public void CheckIfGameDraw() { var _gridMap = new Grid[3, 3]; var gridMapInit = new Grid[9]; var _solutions = new Solutions(); var _gameManager = new GameManagerMockUp(); var _movesRecorder = new MovesRecorder(); var _gameEvent = new GameEvent(); var index = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { _gridMap[i, j] = new Grid(); _gridMap[i, j].PlayerID = index; index++; } } Assert.IsFalse(_gameManager.CheckIfGameEnded(_movesRecorder, _solutions, _gridMap, gridMapInit, _gameEvent)); }
public void CheckComputationsReturnsSolutionTest() { var mockcore = new Mock <ClientNodeProcessingModule>(); var mockcreator = new Mock <IMessageArrayCreator>(); var solutionRequest = new SolutionRequest(); Message[] request = new[] { solutionRequest }; mockcreator.Setup(u => u.Create(solutionRequest)).Returns(request); var mockclient = new Mock <IClusterClient>(); var response = new Solutions(); var noop = new NoOperation(); var responses = new Message[] { response, noop }; mockclient.Setup(u => u.SendRequests(request)).Returns(responses); var clientNode = new ClientNode(mockclient.Object, mockcore.Object, mockcreator.Object); var ret = clientNode.CheckComputations(solutionRequest); Assert.AreEqual(ret, response); }
public void Init() { solution = new Solutions(); }