public override void OnInspectorGUI() { DrawDefaultInspector(); ToggleController myScript = (ToggleController)target; if (GUILayout.Button("Get Origin position")) { myScript.GetCurrentTextPosition(0); } if (GUILayout.Button("Get Final position")) { myScript.GetCurrentTextPosition(1); } GUILayout.Space(10); if (GUILayout.Button("Set to Origin position")) { myScript.SetToTextPosition(0); } if (GUILayout.Button("Set to Final position")) { myScript.SetToTextPosition(1); } }
public async Task GetTogglesAsync_GetResponseWith2ToggleDtos_Ok() { var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.GetTogglesAsync()).Returns(Task.FromResult(ToggleFakeData.GetResponseWith2ToggleDtos())); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = await controller.GetTogglesAsync() as OkNegotiatedContentResult <Response <IEnumerable <ToggleDto> > >; Assert.IsNotNull(responseActionResult); Assert.IsNotNull(responseActionResult); Assert.IsNull(responseActionResult.Content.ErrorCode); Assert.IsNull(responseActionResult.Content.Message); Assert.IsTrue(responseActionResult.Content.IsValid); Assert.IsTrue(responseActionResult.Content.Result.Count() == 2); foreach (var item in responseActionResult.Content.Result) { Assert.IsNotNull(item.Id); Assert.IsNotNull(item.Name); Assert.IsNotNull(item.Version); Assert.IsNotNull(item.Applications); foreach (var app in item.Applications) { Assert.IsNotNull(app.Id); Assert.IsNotNull(app.Name); } } } }
protected override void OnInit() { base.OnInit(); ToggleController toggle = CreateItem(UIComponentManager.Components.toggle, UIContainerTag.Tag1); toggle.ValueChanged += (isOn) => Debug.Log(isOn); ButtonController button = CreateItem(UIComponentsData2.Instance.button, UIContainerTag.Tag0); button.Text = "играть"; button.Click += () => HideShow <LevelsScreen>(); for (int i = 0; i < 3; i++) { button = CreateItem(UIComponentManager.Components.button, UIContainerTag.Tag0); button.Text = "кнопка" + i; int c = i; button.Click += () => { Hide(); IMessageBox messagebox = new SimpleMessageBox("Вы уверены?" + c, ScreenManager.Container.ScreensContainer); messagebox.AddButton("показать уровни", () => ScreenManager.ShowScreen <LevelsScreen>(), true); messagebox.AddButton("вернуться", () => ScreenManager.ShowScreen <MainMenuScreen>()); }; } }
// Use this for initialization void Start() { sliderController = handModels.GetComponent <SliderController>(); toggleController = handModels.GetComponent <ToggleController>(); leftPinch = leftPhysicsHand.GetComponent <GestureDetection>(); foreach (ExtendedFingerDetector detector in leftHand.GetComponents <ExtendedFingerDetector>()) { if (detector.Focus == "Slider") { leftSlider = detector; } else if (detector.Focus == "Buttons") { leftButton = detector; } } rightPinch = rightPhysicsHand.GetComponent <GestureDetection>(); foreach (ExtendedFingerDetector detector in rightHand.GetComponents <ExtendedFingerDetector>()) { if (detector.Focus == "Slider") { rightSlider = detector; } else if (detector.Focus == "Buttons") { rightButton = detector; } } }
protected override void SetReferences() { base.SetReferences(); toggle = GetComponentInChildren <ToggleController>(); controller = GetComponentInParent <LMessengerScreenController>(); responseButtons = GetComponentsInChildren <LToggleableUIButton>(); ExpandPanel.SetActive(false); }
public void Post_EmptyToggle_BadRequest() { var controller = new ToggleController(_repositoryMock.Object); var result = controller.Post(null); var objectResult = result as BadRequestResult; Assert.IsNotNull(objectResult); Assert.AreEqual((int)HttpStatusCode.BadRequest, objectResult.StatusCode); }
public void Put_InvalidId_BadRequest() { var controller = new ToggleController(_repositoryMock.Object); var result = controller.Put(new Guid(), new ToggleDtoInput()); var objectResult = result as BadRequestResult; Assert.IsNotNull(objectResult); Assert.AreEqual((int)HttpStatusCode.BadRequest, objectResult.StatusCode); }
public void Delete_NotFound() { var controller = new ToggleController(_repositoryMock.Object); var result = controller.Delete(new Guid()); var objectResult = result as NotFoundResult; Assert.IsNotNull(objectResult); Assert.AreEqual((int)HttpStatusCode.NotFound, objectResult.StatusCode); }
public void GetById_NotFound() { var controller = new ToggleController(_repositoryMock.Object); var result = controller.Get(new Guid()); var actionResult = result as NotFoundResult; Assert.IsNotNull(actionResult); Assert.AreEqual((int)HttpStatusCode.NotFound, actionResult.StatusCode); }
void LoadData() { ToggleController notScript = toggleNotification.GetComponent <ToggleController>(); ToggleController vibScript = toggleVibration.GetComponent <ToggleController>(); notScript._toggle.isOn = new LoadData().GetBool("Notification"); vibScript._toggle.isOn = new LoadData().GetBool("Vibration"); notScript.Toggle(); vibScript.Toggle(); sliderEffects.GetComponent <Slider>().value = gameManagerScript.effectsVolume; sliderMusic.GetComponent <Slider>().value = gameManagerScript.musicVolume; }
public async Task GetToggledAsync_BadRequest() { var id = string.Empty; var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.GetToggleAsync(id)).Returns(Task.FromResult(new Response <ToggleDto>())); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = (await controller.GetToggleAsync(id)) as BadRequestResult; Assert.IsNotNull(responseActionResult); } }
public void DeleteToggleAsync_BadRequest() { var id = string.Empty; var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.DeleteToggle(id)); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = controller.DeleteToggle(id) as BadRequestResult; Assert.IsNotNull(responseActionResult); } }
public async Task GetTogglesAsync_InternalServerError() { var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.GetTogglesAsync()).Throws(new NullReferenceException()); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = (await controller.GetTogglesAsync()) as ExceptionResult; Assert.IsNotNull(responseActionResult); Assert.IsTrue(responseActionResult.Exception is NullReferenceException); } }
public void DeleteToggleAsync_NotFound() { var id = "12345"; var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.DeleteToggle(id)).Throws(new ArgumentOutOfRangeException()); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = controller.DeleteToggle(id) as NotFoundResult; Assert.IsNotNull(responseActionResult); } }
public async Task PutToggleAsync_BadRequest() { var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.PutToggleAsync(null)); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = await controller.PutToggleAsync(null) as BadRequestResult; Assert.IsNotNull(responseActionResult); } }
public void GetAll_Ok() { _repositoryMock.Setup(rep => rep.GetAll()).Returns(new List <Toggle>()); var controller = new ToggleController(_repositoryMock.Object); var result = controller.Get(null); var actionResult = result as OkObjectResult; var model = actionResult?.Value as IEnumerable <ToggleDtoOutput>; Assert.IsNotNull(actionResult); Assert.IsNotNull(model); _repositoryMock.Verify(rep => rep.GetAll(), Times.Once); Assert.AreEqual((int)HttpStatusCode.OK, actionResult.StatusCode); }
public void DeleteToggleAsync_Ok() { var toggle1 = ToggleFakeData.GetToggleDto1(); var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.DeleteToggle(toggle1.Id)); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = controller.DeleteToggle(toggle1.Id) as OkResult; Assert.IsNotNull(responseActionResult); } }
public void Post_Ok() { var toggleInput = new ToggleDtoInput(); var controller = new ToggleController(_repositoryMock.Object); var result = controller.Post(toggleInput); var actionResult = result as CreatedAtRouteResult; var model = actionResult?.Value as ToggleDtoOutput; Assert.IsNotNull(actionResult); Assert.IsNotNull(model); _repositoryMock.Verify(rep => rep.Save(), Times.Once); Assert.AreEqual((int)HttpStatusCode.Created, actionResult.StatusCode); }
public void DeleteToggleAsync_InternalServerError() { var id = Guid.NewGuid().ToString(); var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.DeleteToggle(id)).Throws(new NullReferenceException()); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = controller.DeleteToggle(id) as ExceptionResult; Assert.IsNotNull(responseActionResult); Assert.IsTrue(responseActionResult.Exception is NullReferenceException); } }
public void Delete_Successful() { var id = new Guid(); _repositoryMock.Setup(rep => rep.Contains(id)).Returns(true); var controller = new ToggleController(_repositoryMock.Object); var result = controller.Delete(id); var actionResult = result as NoContentResult; Assert.IsNotNull(actionResult); _repositoryMock.Verify(rep => rep.Remove(id), Times.Once); _repositoryMock.Verify(rep => rep.Save(), Times.Once); Assert.AreEqual((int)HttpStatusCode.NoContent, actionResult.StatusCode); }
public async Task PutToggleAsync_InternalServerError() { var toogleDto = ToggleFakeData.GetToggleDto2(); var id = Guid.NewGuid().ToString(); var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.PutToggleAsync(toogleDto)).Throws(new NullReferenceException()); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = await controller.PutToggleAsync(toogleDto) as ExceptionResult; Assert.IsNotNull(responseActionResult); Assert.IsTrue(responseActionResult.Exception is NullReferenceException); } }
private void SetInfraredButtonsToRightState() { // sets the on/off toggle button to the right position. This checks if more than half of the infrared of the controller is on/off and then switches accordingly foreach (KeyValuePair <GameObject, InfraredController> button in buttonDictInfraredMenu) { ToggleController toggleController = button.Key.GetComponentInChildren <ToggleController>(); if (domoticaController.CheckifInfraredAreOn(button.Value)) { toggleController.SwitchButtonToOn(); } else { toggleController.SwitchButtonToOff(); } } }
public async Task GetTogglesAsync_GetResponseWithErrorCodeAndMessage_Ok() { var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.GetTogglesAsync()).Returns(Task.FromResult(ToggleFakeData.GetResponseWithErrorCodeAndMessage())); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = await controller.GetTogglesAsync() as OkNegotiatedContentResult <Response <IEnumerable <ToggleDto> > >; Assert.IsNotNull(responseActionResult); Assert.IsNotNull(responseActionResult); Assert.IsNotNull(responseActionResult.Content.ErrorCode); Assert.IsNotNull(responseActionResult.Content.Message); Assert.IsFalse(responseActionResult.Content.IsValid); Assert.IsNull(responseActionResult.Content.Result); } }
public async Task PostToggleAsync_Ok() { var toogleDto = ToggleFakeData.GetToggleDto2(); var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.PostToggleAsync(toogleDto)).Returns(Task.FromResult(new Response <ToggleDto> { IsValid = true, Result = toogleDto })); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = await controller.PostToggleAsync(toogleDto) as OkNegotiatedContentResult <Response <ToggleDto> >; Assert.IsNotNull(responseActionResult); Assert.IsTrue(responseActionResult.Content.IsValid); Assert.IsNotNull(responseActionResult.Content.Result); } }
public void OnClick(float distance = Mathf.Infinity) { if (distance > availableDistance) { return; } //打开商店面板 CommonCanvasManager.GetInstance().OpenCommonCanvas("bag", out m_shopCanvas, true); if (m_toggleTFs == null) { ToggleController toggleController = m_shopCanvas.GetComponentInChildren <ToggleController>(); m_toggleTFs = new Transform[toggleController.tabs.Length]; for (byte i = 0; i < toggleController.tabs.Length; i++) { Toggle toggle = toggleController.tabs[i].toggle; m_toggleTFs[i] = toggle.transform; toggle.gameObject.SetActive(true); byte index = i; toggle.onValueChanged.AddListener(delegate { _OnSelect(index); }); } Button closeButton = m_shopCanvas.transform.GetChild(0).Find("close").GetComponent <Button>(); closeButton.onClick.AddListener(delegate { _Close(); }); } else { m_toggleTFs[0].GetComponent <Toggle>().isOn = true; m_toggleTFs[0].SetAsFirstSibling(); m_toggleTFs[1].GetComponent <Toggle>().isOn = false; m_toggleTFs[1].SetAsLastSibling(); for (int i = 0; i < m_toggleTFs.Length; i++) { m_toggleTFs[i].gameObject.SetActive(true); } } }
public void Put_Successful() { var id = new Guid(); var toggle = new Toggle { Id = id, Name = "test" }; _repositoryMock.Setup(rep => rep.Get(id)).Returns(toggle); var toggleInput = new ToggleDtoInput(); var controller = new ToggleController(_repositoryMock.Object); var result = controller.Put(id, toggleInput); var actionResult = result as NoContentResult; Assert.IsNotNull(actionResult); _repositoryMock.Verify(rep => rep.Save(), Times.Once); Assert.AreEqual((int)HttpStatusCode.NoContent, actionResult.StatusCode); }
public void GetById_Ok() { var id = new Guid(); var toggle = new Toggle { Id = id, Name = "test" }; _repositoryMock.Setup(rep => rep.Get(id)).Returns(toggle); var controller = new ToggleController(_repositoryMock.Object); var result = controller.Get(id); var actionResult = result as OkObjectResult; var model = actionResult?.Value as ToggleDtoOutput; Assert.IsNotNull(actionResult); Assert.IsNotNull(model); Assert.AreEqual((int)HttpStatusCode.OK, actionResult.StatusCode); }
// Update is called once per frame void Update() { if (!isReady) { if (battery != null && bulb != null && resistor != null && toggle != null ) { isReady = true; batteryController = battery.GetComponent <ElectricalElementController>(); bulbController = bulb.GetComponent <BulbController>(); resistorController = resistor.GetComponent <ElectricalElementController>(); toggleController = toggle.GetComponent <ToggleController>(); setupLevel(); } } else { Electrify(); } }
public async Task GetToggledAsync_Ok() { var toggle1 = ToggleFakeData.GetToggleDto1(); var mock = new Mock <IToggleBusinessManager>(); mock.Setup(toggleBusinessManager => toggleBusinessManager.GetToggleAsync(toggle1.Id)).Returns(Task.FromResult(ToggleFakeData.GetResponseWithToggleDto1())); using (var controller = new ToggleController(mock.Object)) { var responseActionResult = (await controller.GetToggleAsync(toggle1.Id)) as OkNegotiatedContentResult <Response <ToggleDto> >; Assert.IsNotNull(responseActionResult); Assert.IsNotNull(responseActionResult.Content); Assert.IsNotNull(responseActionResult.Content.Result); Assert.IsNotNull(responseActionResult.Content.Result.Id); Assert.IsNotNull(responseActionResult.Content.Result.Name); Assert.AreEqual(toggle1.Id, responseActionResult.Content.Result.Id); Assert.AreEqual(toggle1.Name, responseActionResult.Content.Result.Name); Assert.AreEqual(toggle1.Version, responseActionResult.Content.Result.Version); Assert.AreEqual(toggle1.Applications.Count(), responseActionResult.Content.Result.Applications.Count()); } }
void Awake() { instant = this; }