public ActionResult Setup(TestingModel model) { var previewCookie = new HttpCookie("Preview") { Value = model.Preview.ToString() }; var themeCookie = new HttpCookie("Theme") { Value = model.Theme }; if (!model.Preview) { previewCookie.Expires = DateTime.Now.AddMinutes(-1); } if (string.IsNullOrEmpty(model.Theme)) { themeCookie.Expires = DateTime.Now.AddMinutes(-1); } Response.SetCookie(previewCookie); Response.SetCookie(themeCookie); if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.ToString())); } return(RedirectToAction("Index", "Home")); }
public async Task CalculateSomethingRandomValueTest(int min, int max, string operationType, int delta, int a, int b, TestingModel actual, [Frozen] Mock <IRandomService> randomService, [Frozen] Mock <IExternalSleepyService> sleepy, [Frozen] Mock <IFactoryTestingModel> factoryTestingModel, [Frozen] Mock <IAsyncExecutor> asyncExecutor, TestingService sut) { //arrange var rnd = new Random(DateTime.Now.Millisecond); var actualRandomValue = rnd.Next(min, max); randomService.Setup(service => service.GenerateRandomValue(1, 1000)).Returns(actualRandomValue); sleepy.Setup(service => service.SleepForATime()).ReturnsAsync(true); factoryTestingModel.Setup(service => service.Create(operationType, actualRandomValue, a + b + delta)) .Returns(actual); asyncExecutor.Setup(service => service.FromResult(actual)).ReturnsAsync(actual); //act var expected = await sut.CalculateSomethingRandom(a, b); //assert randomService.Verify(service => service.GenerateRandomValue(1, 1000), Times.AtLeastOnce); sleepy.Verify(service => service.SleepForATime(), Times.AtLeastOnce); factoryTestingModel.Verify(service => service.Empty(), Times.AtLeastOnce); factoryTestingModel.Verify(service => service.Create(operationType, actualRandomValue, a + b + delta), Times.AtLeastOnce); asyncExecutor.Verify(service => service.FromResult(actual)); expected.Should().BeEquivalentTo(actual); }
public TestingViewModel(TestingModel model) { ReplyCommand = new ActionCommand(InvokeReply, o => true); BackCommand = new ActionCommand(o => InvokePrev(), o => true); ForwardCommand = new ActionCommand(o => InvokeNext(), o => true); _model = model; InvokeNext(); }
public ActionResult Setup() { var model = new TestingModel { Preview = Request.Cookies.AllKeys.Contains("Preview"), Theme = Request.Cookies["Theme"]?.Value }; return(PartialView(model)); }
public JsonResult GetTestingData() { var result = new TestingModel { Id = 1, Description = "Some Description", Name = "NameTest" }; return(new JsonResult { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult HandelForm(TestingModel ApplicatioNames, TestingModel TestTypes, TestingModel ProjectNames) { string ProjectName = ProjectNames.ProjectName.ToString(); string TestType = TestTypes.TestType.ToString(); string ApplicatioName = ApplicatioNames.ApplicatioName.ToString(); App1TestCases Testobj = new App1TestCases(); switch (ProjectName) { case "lifeAlborzInsurance": { switch (ApplicatioName) { case "AlborzContactManagingDirector": { switch (TestType) { case "AcceptanceTest": string[] testrepo = Testobj.TestAction1(); IList <TestingResultModel> testindexlist = new List <TestingResultModel>(); testindexlist.Add(new TestingResultModel() { TestCheck1 = testrepo[0], TestCheck2 = testrepo[1], TestCheck3 = testrepo[2] }); ViewData["testindexlist"] = testindexlist; return(View("TestResult")); } } break; } break; } } return(View("Index")); }
public AnnTestingService(TestingModel testingModel, ProgressChangedEventHandler progressChangedEventHandler) { _testingModel = testingModel; _progressChangedEventHandler = progressChangedEventHandler; }