public void DeleteIndicator() { BaseCondition component = new Condition() { Id = Guid.NewGuid(), ValueIzq = new StringValue { Data = "hola" }, ValueDer = new StringValue { Data = "hola" }, Operator = "=" }; Indicator indicator = new Indicator() { Color = "red", Id = Guid.NewGuid(), Condition = component }; var mock = new Mock <IIndicatorLogic>(MockBehavior.Strict); mock.Setup(m => m.Remove(It.IsAny <Indicator>())); var controller = new IndicatorsController(mock.Object); var result = controller.Delete(indicator.Id, IndicatorModel.ToModel(indicator)); mock.VerifyAll(); }
// Start is called before the first frame update void Start() { GenerateFire(); UnityEngine.Random.InitState((DateTime.Now.ToString("hh:mm:ss")).GetHashCode()); indicators = GameObject.Find("Indicators").GetComponentInChildren <IndicatorsController>(); }
public void CreateIndicatorOk() { BaseCondition component = new Condition() { Id = Guid.NewGuid(), ValueIzq = new StringValue { Data = "hola" }, ValueDer = new StringValue { Data = "hola" }, Operator = "=" }; Indicator indicator = new Indicator() { Color = "red", Id = Guid.NewGuid(), Condition = component }; var mock = new Mock <IIndicatorLogic>(MockBehavior.Strict); mock.Setup(m => m.Create(It.IsAny <Indicator>())).Returns(indicator); var controller = new IndicatorsController(mock.Object); var result = controller.Post(IndicatorModel.ToModel(indicator)); var createdResult = result as CreatedAtRouteResult; mock.VerifyAll(); }
public void GetIndicatorOK() { BaseCondition component = new Condition() { Id = Guid.NewGuid(), ValueIzq = new StringValue { Data = "hola" }, ValueDer = new StringValue { Data = "hola" }, Operator = "=" }; Indicator indicator = new Indicator() { Color = "red", Id = Guid.NewGuid(), Condition = component }; var mock = new Mock <IIndicatorLogic>(MockBehavior.Strict); mock.Setup(m => m.Get(indicator.Id)).Returns(indicator); var controller = new IndicatorsController(mock.Object); var result = controller.Get(indicator.Id); var createdResult = result as OkObjectResult; var model = createdResult.Value as IndicatorModel; Assert.AreEqual(indicator.Color, model.Color); }
public void CreateNotVaidIndicator() { var mock = new Mock <IIndicatorLogic>(MockBehavior.Strict); mock.Setup(m => m.Create(null)).Throws(new BusinessLogicInterfaceException()); var controller = new IndicatorsController(mock.Object); var result = controller.Post(null); mock.VerifyAll(); Assert.IsInstanceOfType(result, typeof(BadRequestObjectResult)); }
public void GetNotExistingIndicator() { var mock = new Mock <IIndicatorLogic>(MockBehavior.Strict); mock.Setup(m => m.Get(It.IsAny <Guid>())).Throws(new BusinessLogicInterfaceException()); var controller = new IndicatorsController(mock.Object); var result = controller.Get(Guid.NewGuid()); mock.VerifyAll(); Assert.IsInstanceOfType(result, typeof(NotFoundObjectResult)); }
public void Setup() { _fakeGpnContext = new GpnContext(new DbContextOptionsBuilder <GpnContext>().UseSqlServer(@"Data Source=MICROBE\SMPPDB1F2017;Initial Catalog=GPN;Persist Security Info=True;Password=sms_mcc@0802121;User ID=SmsMessageCenter").Options); _fakeIndicatorsController = new IndicatorsController(_fakeGpnContext); _fakeIndicator = new Indicator() { Id = Guid.NewGuid(), Title = "New title", MinValue = 0, MaxValue = 5000, Value = 1000 }; }
public void FullIndicatorForNotExistedCriterion_CheckResponceBody() { // Arrange _controller = new IndicatorsController(_unit); _controller.Request = new HttpRequestMessage(); _controller.Configuration = new HttpConfiguration(); int criterionId = -20; // NotExistedCriterion // Act var responce = _controller.GetFullIndicatorsOfCriterion(criterionId); // Assert IEnumerable <FullIndicator> indicators; Assert.IsTrue(responce.TryGetContentValue <IEnumerable <FullIndicator> >(out indicators)); }
public void FullIndicatorForExistedCriterion_CheckHttpStatusCodeOK() { // Arrange _controller = new IndicatorsController(_unit); _controller.Request = new HttpRequestMessage(); _controller.Configuration = new HttpConfiguration(); int criterionId = 20; // ExistedCriterion HttpResponseMessage response = new HttpResponseMessage(); response.StatusCode = HttpStatusCode.OK; // Act var actualResponce = _controller.GetFullIndicatorsOfCriterion(criterionId); // Assert Assert.AreEqual(actualResponce.StatusCode, response.StatusCode); }
void SpawnFire() { int fireCount = UnityEngine.Random.Range(1, spawnCount); IndicatorsController indicators = GameObject.Find("Indicators").GetComponentInChildren <IndicatorsController>(); indicators.fireStart = fireCount; for (int i = 0; i < fireCount; i++) { bool isDone = false; while (!isDone) { int randomChild = UnityEngine.Random.Range(0, spawnCount - 1); GameObject point = transform.GetChild(randomChild).gameObject; if (!point.activeSelf) { point.SetActive(true); Instantiate(firePrefab, point.transform.position, point.transform.rotation, point.transform); isDone = true; } } } }
public void GetAllIndicators() { BaseCondition component = new Condition() { Id = Guid.NewGuid(), ValueIzq = new StringValue { Data = "hola" }, ValueDer = new StringValue { Data = "hola" }, Operator = "=" }; Indicator indicator = new Indicator() { Color = "red", Id = Guid.NewGuid(), Condition = component }; List <Indicator> indicators = new List <Indicator>(); indicators.Add(indicator); var mock = new Mock <IIndicatorLogic>(MockBehavior.Strict); mock.Setup(m => m.GetAll()).Returns(indicators); var controller = new IndicatorsController(mock.Object); var result = controller.Get(); var createdResult = result as OkObjectResult; var models = createdResult.Value as IEnumerable <IndicatorModel>; mock.VerifyAll(); Assert.AreEqual(indicators[0].Color, models.ToList <IndicatorModel>()[0].Color); }
void Start() { target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); indicators = GameObject.Find("Indicators").GetComponentInChildren <IndicatorsController>(); }