void click() { int nb; GameObject error; GameObject disable; model = GameObject.Find("Model"); ModelTest modelScr = model.GetComponent <ModelTest>(); string name = inputName.GetComponent <TMP_InputField>().text; // string min = inputMin.GetComponent<TMP_InputField>().text; string max = inputMax.GetComponent <TMP_InputField>().text; string desc = inputDesc.GetComponent <TMP_InputField>().text; string turn_game = "false"; string async_game = "false"; if (int.TryParse(max, out nb) == false) { error = Instantiate(wrong) as GameObject; disable = Instantiate(paper) as GameObject; error.GetComponentInChildren <ConfirmErrorBtn>().setParent(error); error.GetComponentInChildren <ConfirmErrorBtn>().setDisableScreen(disable); error.transform.SetParent(canvas.transform, false); disable.transform.SetParent(canvas.transform, false); disable.transform.SetSiblingIndex(98); error.transform.SetSiblingIndex(99); } else { modelScr.updateField(projectName, name, max, desc, CallDispatcher, async_game, turn_game); } }
public ActionResult Index() { List <DisplayStudentTestsModel> testList = new List <DisplayStudentTestsModel>(); try { IToken temp = _tokenStore; List <ModelToken> curToken = _tokenStore.GetTokensByUsername(User.Identity.Name).ToList(); curToken.ForEach(token => { DisplayStudentTestsModel cur = new DisplayStudentTestsModel(token.TestID); ModelTest curTest = _testStore.GetTest(token.TestID); cur.TestName = curTest.TestName; cur.Date = curTest.StartTime; String markStud = SumStudAnswerMarks(_studentAnswer.GetStudentAnswersByStudentByTest(User.Identity.Name, token.TestID)) ?? "n/a"; String markTest = ""; if (!markStud.Equals("n/a")) { markTest = SumTestMarks(_question.GetQuestionsByTest(token.TestID)) ?? "n/a"; } cur.Mark = markStud + " / " + markTest; testList.Add(cur); }); } catch (NullReferenceException e) { return(View()); } return(View(testList)); }
public async Task <ActionResult> HelloWorld() { var options = new PusherOptions { Cluster = "ap1", Encrypted = true }; ModelTest mdl = new ModelTest(); List <ModelTest> result2 = new List <ModelTest>(); mdl.Mcadress = "1234"; mdl.DeviceID = "DEV001"; mdl.value = 2; result2.Add(mdl); var pusher = new Pusher( "1099541", "4d57b796a305ad74611d", "1033ace6b885d1937090", options); var result = await pusher.TriggerAsync( "Dashboard-device", "my-event", new { message = result2 }); return(new HttpStatusCodeResult((int)HttpStatusCode.OK)); }
public IActionResult Index() { var testmodel = new ModelTest(); testmodel.XinChao = "đây là model test"; return(View(testmodel)); }
private void OnClickQ5() { if (true == flag) { return; } flag = true; string path = @"D:/5.wav"; // string path; //#if !NETFX_CORE //UWP下 // path = @"D:/5.wav"; //#else // path = ApplicationData.Current.LocalFolder+"/5.wav"; //#endif string str = VedioToText(path); Debug.Log(str); ModelTest obj = JsonUtility.FromJson <ModelTest>(str); string strDialogText = DialogText(obj.result); Debug.Log(strDialogText); Model model = JsonUtility.FromJson <Model>(strDialogText); string result = model.data.answers[0].answer; StartCoroutine(AnswersToAudio(result)); }
public void CreateTest(ModelTest model, string username, List <ModelQuestion> questions) { using (var transaction = _ctx.Database.BeginTransaction()) { try { model.TestActive = true; model.Username = username; var entity = model.ToEntity(); Test test = _ctx.Insert(entity); _ctx.SaveChanges(); Each(questions, x => (new StoreQuestion(_ctx)).CreateQuestion(x, test.TestID)); transaction.Commit(); } catch (Exception e) { transaction.Rollback(); throw new ArgumentException(e.Message); } } }
override public void apply() { model = GameObject.Find("Model"); ModelTest modelScript = model.GetComponent <ModelTest>(); modelScript.getAll(applyInServerResponse); }
public ActionResult Taking(ModelTest test) { if (test.Questions.All(x => x.Seçim != null)) { SurveyDbContext surveyEntities = new SurveyDbContext(); int surveytakerid = (int)Session["CurrentUser"]; int aı = surveyEntities.Answers.Count() + 1; int i = 0; foreach (var item in test.Questions) { Answer answer = new Answer(); answer.AnswerId = aı; while (surveyEntities.Answers.Any(x => x.AnswerId == answer.AnswerId)) { answer.AnswerId = new Random().Next(); } answer.QuestionId = item.Question.QuestionId; answer.UserId = surveytakerid; answer.Seçim = item.Seçim; surveyEntities.Answers.Add(answer); aı++; i++; } surveyEntities.SaveChanges(); return(RedirectToAction("Index", "Home")); } else { TempData["Error"] = "Tüm Sorulara Cevap Vermelisiniz"; return(RedirectToAction("Taking", "TakingSurvey", new { id = test.id })); } }
public void InsertNewTest(ModelTest test, string cs) { using (IDbConnection cnn = new SQLiteConnection(cs)) { var cmd = cnn.Query <ModelTest>("Insert Into TEST(TEST_NAME,QUESTION_ID,TEST_QUESTION,OPTION_A,OPTION_B,OPTION_C,OPTION_D,CORRECT_ANSWER)Values" + $"('{test.Test_Name}','{test.QuestionNumber}','{test.Test_Question}','{test.Option_A}','{test.Option_B}','{test.Option_C}','{test.Option_D}','{test.Correct_Answer}')", new DynamicParameters()); } }
// GET: Home public ActionResult Index() { ModelTest model = new ModelTest { EnumTest = EnumTest.Test2 }; return(View("View", model)); }
public void ModelValidatiorsMustMenorDeIdadeComCpfNAOObrigatorioTest() { Result <ModelTest> result = ModelTest.Criar("Myfr", new DateTime(2009, 8, 16), null); Assert.True(result.Valid); Assert.NotNull(result.Value); Assert.Empty(result.Validations); }
public void ModelValidatiorsOkTest() { Result <ModelTest> result = ModelTest.Criar("My Framework", new DateTime(1987, 8, 16), "157.151.171-99"); Assert.True(result.Valid); Assert.NotNull(result.Value); Assert.Empty(result.Validations); }
public void Test_method_Add() { DbContextMock dbContextMock = new DbContextMock("testAdd"); ModelRepository <ModelTest> modelRepository = new ModelRepository <ModelTest>(dbContextMock as IDbContext); ModelTest response = modelRepository.Add(Register()); Assert.AreEqual(Register().Id, response.Id); }
public void ModelValidatiorsNomeNOkTest() { Result <ModelTest> result = ModelTest.Criar("Al", new DateTime(1987, 8, 16), "157.151.171-99"); Assert.False(result.Valid); Assert.Null(result.Value); Assert.NotEmpty(result.Validations); Assert.Equal("Campo deve ter ao menos 3 caracteres.", result.Validations.First().Message); Assert.Equal("ModelTest.Nome", result.Validations.First().Attribute); }
public void ModelValidatiorsMustMaiorDeIdadeComCpfObrigatorioTest() { Result <ModelTest> result = ModelTest.Criar("Myfr", new DateTime(1987, 8, 16), null); Assert.False(result.Valid); Assert.Null(result.Value); Assert.NotEmpty(result.Validations); Assert.Equal("O CPF é obrigatório.", result.Validations.First().Message); Assert.Equal("ModelTest.Cpf", result.Validations.First().Attribute); }
public void Should_serialize_enum_to_string() { //Given var model = new ModelTest { EnumModel = TestEnum.Freddy }; //When var result = SimpleJson.SerializeObject(model, new NancySerializationStrategy(false, true)); //Then result.ShouldEqual("{\"enumModel\":\"Freddy\"}"); }
public ActionResult ViewStudentAccess(int TestID) { ModelTest curTest = _testStore.GetTest(TestID); ViewBag.Time = curTest.EndTime - curTest.StartTime; ViewBag.Date = curTest.Date; ViewBag.TestID = TestID; List <String> students = _tokenStore.GetTokensByTest(TestID).Select(cur => cur.Username).ToList(); return(View()); }
public PresenterDesign(ModelTest model, InterfaceTest viev) { this.model = model; this.vievTest = viev; this.vievTest.Design.LoadTestName += VievLoadTestName; this.vievTest.Design.LoadQuestions += VievLoadQuestion; this.vievTest.Design.LoadAnswers += VievLoadAnswers; this.vievTest.Design.AddPoints += VievAddPoints; this.vievTest.Design.Summary += VievSummary; this.vievTest.LoadPath += VievLoadPath; }
protected RuleTestItem(PrototypeError item) { //Discarded unreachable code: IL_0002, IL_0006 //IL_0003: Incompatible stack heights: 0 vs 1 //IL_0007: Incompatible stack heights: 0 vs 1 SingletonReader.PushGlobal(); base._002Ector(); ContextClientBridge.RunClient(item, "serializer"); baseProperty = item; containerProperty = item._0001(); }
private string OnClickQ7ThreadFun(object path) { string reWavPath = (string)path; string str = VedioToText(reWavPath); ModelTest obj = JsonUtility.FromJson <ModelTest>(str); string strDialogText = DialogText(obj.result); Model model = JsonUtility.FromJson <Model>(strDialogText); string result = model.data.answers[0].answer; return(result); }
void click() { model = GameObject.Find("Model"); ModelTest modelScr = model.GetComponent <ModelTest>(); modelScr.removeElem(idToRemove); ButtonListener but = gameObject.GetComponent <ButtonListener>(); but.SendToDispatch(); }
public void Should_serialize_enum_to_string() { // Given var model = new ModelTest { EnumModel = TestEnum.Freddy }; // When var result = SimpleJson.SerializeObject(model, new NancySerializationStrategy(false, true), false); // Then result.ShouldEqual("{\"enumModel\":\"Freddy\"}"); }
/// <summary> /// 获取坝的名字 /// </summary> void GetDropdown() { ModelTest m = new ModelTest(); string blostr = Resources.Load <TextAsset>("JsonInfo/RightPanelJson").text; m = JsonUtility.FromJson <ModelTest>(blostr); for (int i = 0; i < m.damName.Count; i++) { rightUpDamName.Add(m.damName[i].name); // Debug.Log("GetDropdown"+ rightUpDamName.Count); } }
public void SetValueTest(string name) { ModelTest model = new ModelTest { Name = "Name1" }; ColumnMapping mapping = new ColumnMapping() { Info = model.GetType().GetProperty("Name") }; mapping.SetValue(model, name); Assert.AreEqual(name, model.Name); }
void click() { ModelTest ModelScript = Model.GetComponent <ModelTest>(); ButtonListener but = gameObject.GetComponent <ButtonListener>(); but.addParam("description", desc.GetComponent <TMP_InputField>().text); but.addParam("name", name.GetComponent <TMP_InputField>().text); but.addParam("max", max.GetComponent <TMP_InputField>().text); Dictionary <string, string> param = but.getParam(); ModelScript.addCollections(param["name"], param["max"], param["description"], "0", "0", applyInServerResponse); param.Clear(); }
private void OnClickQ7ThreadFun(object path) { string reWavPath = (string)path; string str = VedioToText(reWavPath); Debug.Log("str: " + str); ModelTest obj = JsonUtility.FromJson <ModelTest>(str); string strDialogText = DialogText(obj.result); Debug.Log("strDialogText: " + strDialogText); Model model = JsonUtility.FromJson <Model>(strDialogText); string result = model.data.answers[0].answer; Result = result; }
public async Task post_model_throw_bad_request() { var db = BaseDbContextMock.GetDbContext(); var controller = new BaseControllerMock(db); controller.ModelState.AddModelError("String", "Required"); controller.ModelState.AddModelError("Integer", "Required"); var item = new ModelTest(); var actionResult = await controller.PostItemAsync(item); Assert.IsType <BadRequestObjectResult>(actionResult); Assert.Equal((int)System.Net.HttpStatusCode.BadRequest, (actionResult as ObjectResult).StatusCode); Assert.NotNull((actionResult as ObjectResult).Value); }
private IEnumerator OnClickQ7IEnumerator() { string path = ApplicationData.Current.LocalFolder.Path + "/" + reWav.StopRecording() + ".wav"; Destroy(GameObject.Find("Sofa/Scenario/fb").GetComponent <RecordingWav>()); string str = VedioToText(path); ModelTest obj = JsonUtility.FromJson <ModelTest>(str); string strDialogText = DialogText(obj.result); Model model = JsonUtility.FromJson <Model>(strDialogText); string result = model.data.answers[0].answer; StartCoroutine(AnswersToAudio(result)); VedioSource.volume = 0.5f; yield return(0); }
public async Task post_model() { var db = BaseDbContextMock.GetDbContext(); var controller = new BaseControllerMock(db); var item = new ModelTest() { String = "TestPost", Integer = 1 }; var actionResult = await controller.PostItemAsync(item); var ent = await db.Models.Where(x => x.String == "TestPost").FirstAsync(); Assert.IsType <CreatedResult>(actionResult); Assert.NotNull(ent); }
public override void apply() { int id = int.Parse(args["id"]); string projectName = args["project_name"]; model = GameObject.Find("Model"); ModelTest modelScr = model.GetComponent <ModelTest>(); modelScr.find(projectName, applyInServerResponse); ConfirmModifyButton butScr = confirmButton.GetComponent <ConfirmModifyButton>(); butScr.setIdToModify(id); RemoveProjectButton rmButScr = removeButton.GetComponent <RemoveProjectButton>(); rmButScr.setIdToRemove(id); }
// GET: TakingSurvey public ActionResult Taking(int id) { SurveyDbContext surveyEntities = new SurveyDbContext(); Test test = surveyEntities.Tests.Include(x => x.Questions.Select(s => s.Choices)).Single(x => x.TestId == id); ModelTest modelTest = new ModelTest(); modelTest.id = id; modelTest.Questions = new List <ModelQuestion>(); foreach (var item in test.Questions) { ModelQuestion modelQuestion = new ModelQuestion(); modelQuestion.Question = item; modelTest.Questions.Add(modelQuestion); } return(View(modelTest)); }
public void Setup() { _controller = new ViewTestController(); _modelTest = new ModelTest<TestViewModel>(_controller); }