public void GetMethod_IdNotExist() { ProcessorController controller = new ProcessorController(_uploadImageServiceMock.Object, _processorMock.Object); var result = controller.Get("1-2-3"); Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult)); }
public void DeleteMethod() { ProcessorController controller = new ProcessorController(_uploadImageServiceMock.Object, _processorMock.Object); var result = controller.Delete("1-2-4"); Assert.IsInstanceOfType(result, typeof(StatusCodeResult)); var value = ((StatusCodeResult)result).StatusCode; Assert.AreEqual(System.Net.HttpStatusCode.NoContent, value); }
public async Task PostMethod_WithoutContent() { ProcessorController controller = new ProcessorController(_uploadImageServiceMock.Object, _processorMock.Object); controller.Request = GetHttpRequest(false); var result = await controller.Post(); Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult)); var value = (BadRequestErrorMessageResult)result; Assert.AreEqual(0, _processorMock.Count); Assert.AreEqual("Не передан файл для загрузки.", value.Message); }
public async Task PostMethod_WithContent() { ProcessorController controller = new ProcessorController(_uploadImageServiceMock.Object, _processorMock.Object); controller.Request = GetHttpRequest(); var result = await controller.Post(); Assert.IsInstanceOfType(result, typeof(CreatedAtRouteNegotiatedContentResult <string>)); var value = (CreatedAtRouteNegotiatedContentResult <string>)result; Assert.AreEqual(1, _processorMock.Count); Assert.AreEqual("DefaultApi", value.RouteName); Assert.AreEqual(2, value.RouteValues.Count); }
public void GetMethod_IdExist() { var status = new ProcessStatusInfo(); status.SetProgress(1); status.SetStatus(ProcessStatusEnum.Done); _processorMock.Add("1-2-4", status); ProcessorController controller = new ProcessorController(_uploadImageServiceMock.Object, _processorMock.Object); var result = controller.Get("1-2-4"); Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult <ProcessStatusInfoBase>)); ProcessStatusInfoBase value = ((OkNegotiatedContentResult <ProcessStatusInfoBase>)result).Content; Assert.AreEqual(1, value.Progress); Assert.AreEqual(ProcessStatusEnum.Done, value.Status); }
void Update() { recently_unfocused -= Time.deltaTime; transition_time -= Time.deltaTime; pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); pos.x = Mathf.Round(pos.x); pos.y = Mathf.Round(pos.y); if (selected != "") { interpreter.text = ship.GetComponentToString(selected); interpreter.GetComponent <RectTransform>().sizeDelta = new Vector2(interpreter.GetComponent <RectTransform>().sizeDelta.x, interpreter.text.Split('\n').Length * 26); } else if (focused != "") { interpreter.text = ship.GetComponentToString(focused); interpreter.GetComponent <RectTransform>().sizeDelta = new Vector2(interpreter.GetComponent <RectTransform>().sizeDelta.x, interpreter.text.Split('\n').Length * 26); } else { placement_overlay.transform.position = pos; interpreter.text = ""; interpreter.GetComponent <RectTransform>().sizeDelta = new Vector2(interpreter.GetComponent <RectTransform>().sizeDelta.x, interpreter.text.Split('\n').Length * 26); } if (Input.GetMouseButtonDown(0)) { clicked = true; click_duration = Time.time; } if (Input.GetMouseButtonUp(0) && Time.time - click_duration < .5f) { selected_processor = ship.GetProcessorController(selected); if (selected_processor != null && Input.mousePosition.x > 3 * Screen.width / 4 && Input.mousePosition.y < 9 * Screen.height / 10) { SwitchLeftView(Syntax); toggles[GetActiveToggle()].isOn = false; } if (selected == "" && recently_unfocused < 0 && Input.mousePosition.x > Screen.width / 4 && Input.mousePosition.x < 3 * Screen.width / 4) { if (focused != "") { Select(focused); } else { GameObject object_reference = Prefabs[GetActiveToggle()]; var component_gameObject = Instantiate(object_reference, pos, Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject; //move this logic to structure controller, use IfKeyExists int component_count = 1; while (ship.transform.Find("Rotator").Find(object_reference.name + component_count) != null) { component_count++; } component_gameObject.name = object_reference.name + component_count; component_gameObject.GetComponent <SpriteRenderer>().size = object_reference.GetComponent <ComponentController>().GetMinimumSize(); component_gameObject.transform.SetParent(ship.transform.Find("Rotator")); component_gameObject.transform.localPosition = new Vector2( Mathf.Round(component_gameObject.transform.localPosition.x), Mathf.Round(component_gameObject.transform.localPosition.y) ); component_gameObject.transform.localEulerAngles = new Vector3(0, 0, 0); // Focus(component_gameObject.name); } } } }