public void FibonacciMatrixPost_IncorrectString_ReturnsPartialViewWithFlagFalse()
        {
            var controller = new BasicAlgorithmsController();

            var partialView = controller.FibonacciMatrix("10a");

            Assert.AreEqual(false, ((ResultsViewModel)partialView.Model).Success);
        }
        public void BinarySearchPost_IncorrectString_ReturnsPartialViewWithFlagFalse()
        {
            var controller = new BasicAlgorithmsController();

            var partialView = controller.BinarySearch("a", 3);

            Assert.AreEqual(false, ((ResultsViewModel)partialView.Model).Success);
        }
        public void GCDPost_CorrectString_ReturnsPartialViewWithFlagTrueAndResultFromImplementations()
        {
            var basicAlgorithmsMock = new Mock<BasicAlgorithms>();
            basicAlgorithmsMock.Setup(m => m.GCD(10, 312)).Returns(2);
            var controller = new BasicAlgorithmsController(basicAlgorithmsMock.Object);

            var partialView = controller.GCD("10", "312");

            Assert.AreEqual(true, ((ResultsViewModel)partialView.Model).Success);
            Assert.AreEqual("2", ((ResultsViewModel)partialView.Model).Result);
        }
        public void FibonacciMatrixPost_CorrectString_ReturnsPartialViewWithFlagTrueAndResultFromImplementations()
        {
            var basicAlgorithmsMock = new Mock<BasicAlgorithms>();
            basicAlgorithmsMock.Setup(m => m.FibonacciNumber(10)).Returns(55);
            var controller = new BasicAlgorithmsController(basicAlgorithmsMock.Object);

            var partialView = controller.FibonacciMatrix("10");

            Assert.AreEqual(true, ((ResultsViewModel)partialView.Model).Success);
            Assert.AreEqual("55", ((ResultsViewModel)partialView.Model).Result);
        }
        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);
        }
        public void RussianMultiplicationPost_IncorrectString_ReturnsPartialViewWithFlagFalse()
        {
            var controller = new BasicAlgorithmsController();

            var partialView = controller.RussianMultiplication("10a", "x");

            Assert.AreEqual(false, ((ResultsViewModel)partialView.Model).Success);
        }
        public void MinPost_CorrectString_ReturnsPartialViewWithFlagTrueAndResultFromImplementations()
        {
            var basicAlgorithmsMock = new Mock<BasicAlgorithms>();
            basicAlgorithmsMock.Setup(m => m.Min(It.IsAny<int[]>())).Returns(0);
            var controller = new BasicAlgorithmsController(basicAlgorithmsMock.Object);

            var partialView = controller.Min("12 1 0 3");

            Assert.AreEqual(true, ((ResultsViewModel)partialView.Model).Success);
            Assert.AreEqual("0", ((ResultsViewModel)partialView.Model).Result);
        }
        public void MergePost_IncorrectSecondString_ReturnsPartialViewWithFlagFalse()
        {
            var controller = new BasicAlgorithmsController();

            var partialView = controller.Merge("1 2", "b");

            Assert.AreEqual(false, ((ResultsViewModel)partialView.Model).Success);
        }
        public void MergePost_CorrectString_ReturnsMergedArrays()
        {
            var basicAlgorithmsMock = new Mock<BasicAlgorithms>();
            basicAlgorithmsMock.Setup(m => m.Merge(new[] { 1, 2, 6 }, new[] { 3, 5, 9 })).Returns(new[] { 1, 2, 3, 5, 6, 9 });
            var controller = new BasicAlgorithmsController(basicAlgorithmsMock.Object);

            var partialView = controller.Merge("1 2 6", "3 5 9");

            Assert.AreEqual(true, ((ResultsViewModel)partialView.Model).Success);
            Assert.AreEqual("1, 2, 3, 5, 6, 9", ((ResultsViewModel)partialView.Model).Result);
        }