public void BinarySearchPost_IncorrectString_ReturnsPartialViewWithFlagFalse() { var controller = new BasicAlgorithmsController(); var partialView = controller.BinarySearch("a", 3); Assert.AreEqual(false, ((ResultsViewModel)partialView.Model).Success); }
public void BinarySearchPost_CorrectString_NoElementInCollection_ReturnsPartialViewWithFlagTrueAndNoFoundMessage() { var basicAlgorithmsMock = new Mock<BasicAlgorithms>(); basicAlgorithmsMock.Setup(m => m.BinarySearch(It.IsAny<int[]>(), It.IsAny<int>())).Returns(-1); var controller = new BasicAlgorithmsController(basicAlgorithmsMock.Object); var partialView = controller.BinarySearch("0 1 3 12", 6); Assert.AreEqual(true, ((ResultsViewModel)partialView.Model).Success); Assert.AreEqual("elementu 6 nie ma w zbiorze", ((ResultsViewModel)partialView.Model).Result); }