public void GetPerformanceSettings()
        {
            long customerId = 1;
            mockedTrainRepository.Setup(m => m.GetAll()).Returns(new List<train>().AsQueryable());
            mockedVesselRepository.Setup(m => m.GetAll()).Returns(new List<vessel>().AsQueryable());// (new customer_water() { first_sourceID = 1, second_sourceID = 1 });

            var controller = new PredictiveSystemController(mockedPredictiveRepository.Object, mockedPredictiveModelService.Object, mockedCustomerRepository.Object, mockedRepositoryCustomer.Object, mockedVesselRepository.Object, mockedTrainRepository.Object);
            controller.ControllerContext = new ControllerContext();
            var mockedHttpContext = new Mock<HttpContextBase>();
            var mockedSessionState = new HttpSessionMock();
            mockedHttpContext.SetupGet(ctx => ctx.Session).Returns(mockedSessionState);
            controller.ControllerContext.HttpContext = mockedHttpContext.Object;
            controller.ControllerContext.HttpContext.Session["CustomerId"] = customerId;

            var returnObj = controller.GetPerformanceSettings();
            Assert.IsNotNull(returnObj);
            Assert.IsInstanceOfType(returnObj, typeof(PartialViewResult));
            var result = (PartialViewResult)returnObj;
            Assert.IsNotNull(result);
            Assert.AreEqual(result.ViewName, "PerformanceSettings");
            mockedTrainRepository.Verify(m => m.GetAll(), Times.Once());
            mockedVesselRepository.Verify(m => m.GetAll(), Times.Once());
        }
 public void Index()
 {
     var controller = new PredictiveSystemController(mockedPredictiveRepository.Object, mockedPredictiveModelService.Object, mockedCustomerRepository.Object, mockedRepositoryCustomer.Object, mockedVesselRepository.Object, mockedTrainRepository.Object);
     var returnObj = controller.Index();
     Assert.IsNotNull(returnObj);
     Assert.IsInstanceOfType(returnObj, typeof(ViewResult));
     var result = (ViewResult)returnObj;
     Assert.IsNotNull(result);
 }
        public void ThroughputChart()
        {
            double startingSS = 25.0;
            double resinLifeExpectancy = 364;
            int simulationconfidence = 95;
            int num_simulation_iterations = 100;
            string simMethod = "Modal value";
            int stdDev_threshold = 2;
            double resinAge = 0;
            double RTIcleaning_effectivness = 62.0;
            double Replacement_Level = 10;
            double RTIcleaning_Level = 17.0;
            double ReGen_effectivness = 99.75;
            string SelectedTrain = "0";
            bool DontReplaceResin = false;
            bool IsDashboard = false;
            double CleaningEffectiveness = 28.0;
            mockedPredictiveModelService.Setup(m => m.CalculateMinSaltSplit(1, "0")).Returns(new List<double>() { 1, 2 });
            mockedPredictiveModelService.Setup(m => m.CurrentSSConditions(1, 100, 100)).Returns(new Dictionary<double, double>());
            mockedPredictiveModelService.Setup(m => m.Thoughputchart(It.IsAny<string>(), It.IsAny<double>(), It.IsAny<double>(), It.IsAny<double>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<double>(), It.IsAny<double>(), It.IsAny<double>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(new PriceData() { CleanThroughput = new Dictionary<DateTime, Tuple<int, double, string>>(), NormalOpsThroughput = new Dictionary<DateTime, Tuple<int, double, string>>(), RegenTimeAverageBefore = 5, RegenTimeAverageAfter = 5, RegensPerWeekAverageBefore = 5, RegensPerWeekAverageAfter = 5, HoursPerRunAverageBefore = 5, HoursPerRunAverageAfter = 5, ThroughputAverageBefore = 5, ThroughputAverageAfter = 5 });
            var controller = new PredictiveSystemController(mockedPredictiveRepository.Object, mockedPredictiveModelService.Object, mockedCustomerRepository.Object, mockedRepositoryCustomer.Object, mockedVesselRepository.Object, mockedTrainRepository.Object);
            controller.ControllerContext = new ControllerContext();
            var mockedHttpContext = new Mock<HttpContextBase>();
            var mockedSessionState = new HttpSessionMock();
            mockedHttpContext.SetupGet(ctx => ctx.Session).Returns(mockedSessionState);
            controller.ControllerContext.HttpContext = mockedHttpContext.Object;
            controller.ControllerContext.HttpContext.Session["CustomerId"] = 1;

            var returnObj = controller.ThroughputChart(startingSS, resinLifeExpectancy, simulationconfidence, num_simulation_iterations, simMethod, stdDev_threshold, resinAge, RTIcleaning_effectivness, Replacement_Level, RTIcleaning_Level, ReGen_effectivness, SelectedTrain, DontReplaceResin, CleaningEffectiveness, IsDashboard);
            Assert.IsNotNull(returnObj);
            Assert.IsInstanceOfType(returnObj, typeof(ViewResult));
            var result = (ViewResult)returnObj;
            Assert.IsNotNull(result);
        }
 public void SystemConditions()
 {
     SystemConditions NewSystemConditionsLocal = new SystemConditions();
     var controller = new PredictiveSystemController(mockedPredictiveRepository.Object, mockedPredictiveModelService.Object, mockedCustomerRepository.Object, mockedRepositoryCustomer.Object, mockedVesselRepository.Object, mockedTrainRepository.Object);
     controller.ControllerContext = new ControllerContext();
     var returnObj = controller.SystemConditions();
     Assert.IsNotNull(returnObj);
     Assert.IsInstanceOfType(returnObj, typeof(PartialViewResult));
     var result = (PartialViewResult)returnObj;
     Assert.IsNotNull(result);
 }
        public void PredictiveSystemPerformance()
        {
            long customerId = 1;
            SystemSummaryViewModel systemSummaryViewModel = new SystemSummaryViewModel();
            mockedCustomerRepository.Setup(m => m.GetAll()).Returns(new List<customer>().AsQueryable());
            mockedRepositoryCustomer.Setup(m => m.GetWaterSourceIds(customerId)).Returns(new customer_water() { first_sourceID = 1, second_sourceID = 1 });
            mockedRepositoryCustomer.Setup(m => m.GetCustomerTrains(customerId)).Returns(new List<train>());
            mockedVesselRepository.Setup(m => m.GetAll()).Returns((new List<vessel>()).AsQueryable());

            var controller = new PredictiveSystemController(mockedPredictiveRepository.Object, mockedPredictiveModelService.Object, mockedCustomerRepository.Object, mockedRepositoryCustomer.Object, mockedVesselRepository.Object, mockedTrainRepository.Object);
            controller.ControllerContext = new ControllerContext();
            var mockedHttpContext = new Mock<HttpContextBase>();
            var mockedSessionState = new HttpSessionMock();
            mockedHttpContext.SetupGet(ctx => ctx.Session).Returns(mockedSessionState);
            controller.ControllerContext.HttpContext = mockedHttpContext.Object;
            controller.ControllerContext.HttpContext.Session["CustomerId"] = customerId;
            controller.ControllerContext.HttpContext.Session["HasTrainDetails"] = "Verify";

            var returnObj = controller.PredictiveSystemPerformance();
            Assert.IsNotNull(returnObj);
            Assert.IsInstanceOfType(returnObj, typeof(ViewResult));
            var result = (ViewResult)returnObj;
            Assert.IsNotNull(result);
            mockedCustomerRepository.Verify(m => m.GetAll(), Times.Once());
            mockedRepositoryCustomer.Verify(m => m.GetWaterSourceIds(customerId), Times.Once());
            mockedRepositoryCustomer.Verify(m => m.GetCustomerTrains(customerId), Times.Once());
            mockedVesselRepository.Verify(m => m.GetAll(), Times.Once());
        }
 public void PlotSaltSplitChart()
 {
     double numWeeks = 364.0;
     double AvgResinage = 0;
     double startingSS = 25.0;
     double maxDegSS = 62.0;
     string SelectedTrain = "0";
     double CleaningEffectiveness = 28.0;
     bool IsDashboard = false;
     mockedPredictiveModelService.Setup(m => m.CalculateMinSaltSplit(1, SelectedTrain)).Returns(new List<double>() { 1, 2 });
     mockedPredictiveModelService.Setup(m => m.CurrentSSConditions(1, 100, 100)).Returns(new Dictionary<double, double>());
     mockedPredictiveModelService.Setup(m => m.ComputeDataPoints(numWeeks, startingSS, maxDegSS)).Returns(new Dictionary<double, double>());
     var controller = new PredictiveSystemController(mockedPredictiveRepository.Object, mockedPredictiveModelService.Object, mockedCustomerRepository.Object, mockedRepositoryCustomer.Object, mockedVesselRepository.Object, mockedTrainRepository.Object);
     controller.ControllerContext = new ControllerContext();
     var mockedHttpContext = new Mock<HttpContextBase>();
     var mockedSessionState = new HttpSessionMock();
     mockedHttpContext.SetupGet(ctx => ctx.Session).Returns(mockedSessionState);
     controller.ControllerContext.HttpContext = mockedHttpContext.Object;
     controller.ControllerContext.HttpContext.Session["CustomerId"] = 1;
     var returnObj = controller.PlotSaltSplitChart(numWeeks, AvgResinage, startingSS, maxDegSS, SelectedTrain, CleaningEffectiveness, IsDashboard);
     Assert.IsNotNull(returnObj);
     Assert.IsInstanceOfType(returnObj, typeof(PartialViewResult));
     var result = (PartialViewResult)returnObj;
     Assert.IsNotNull(result);
 }