public static void Initialize(TestContext testContext) { var repository = new Mock <IAlphaRepository <Car> >(); repository.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(new Car())); controller = new AlphaController <Car>(repository.Object); }
void ConstructObj() { AlphaController alpha = GameObject.FindObjectOfType <AlphaController>(); // if both required objects are present, instantiate if (buildableGear && buildableMagnet && safe) // mobi-lift { safe = false; Invoke("MakeSafe", 0.5f); sourceBuildArea.Play(); Destroy(buildableGear); Destroy(buildableMagnet); Instantiate(mobiLift, transform.position + new Vector3(0, 1.25f, 0), new Quaternion(0, 0, 0, 0)); if (alpha) { alpha.animator.primary(); } } else if (buildableMagnet && buildableBattery && safe) // electromagnet { safe = false; Invoke("MakeSafe", 0.5f); sourceBuildArea.Play(); Destroy(buildableMagnet); Destroy(buildableBattery); Instantiate(electromagnet, transform.position + new Vector3(0, 2, 0), new Quaternion(0, 0, 0, 0)); if (alpha) { alpha.animator.primary(); } } //if (buildableA && buildableB)... }
public void ForGetAlphaValue_ReturnStockReturns_ForValidStock() { // Arrange const string stockSymbol = "AAPL"; const string benchmarkSymbol = "MSFT"; var message = string.Empty; var mock = new Mock <IStockReturns>(); var settings = new ConfigurationVariables() { MaxDaysInDateRange = 365 }; var configurationVariables = Options.Create(settings); var stockReturns = JsonConvert.DeserializeObject <StockReturn>(TestConstants.StockReturns.GoodData); var stockReturnsWithMessage = (stockReturns, message); mock.Setup(d => d.GetStockReturnsBySymbolOverDateRangeAsync(stockSymbol, null, null)).ReturnsAsync(stockReturnsWithMessage); //.ReturnsAsync(stockReturnsWithMessage); mock.Setup(d => d.GetStockReturnsBySymbolOverDateRangeAsync(benchmarkSymbol, null, null)).ReturnsAsync(stockReturnsWithMessage); //.ReturnsAsync(stockReturnsWithMessage); var controller = new AlphaController(mock.Object, configurationVariables); // Act var result = Convert.ToDecimal(((ObjectResult)controller.Get(stockSymbol, benchmarkSymbol).Result.Result).Value); // Assert Assert.Equal(0, result); }
public void ForGetAlphaValue_ReturnHttpNotFound_ForInvalidStock() { // Arrange const string stockSymbol = "Z1X"; const string benchmarkSymbol = "MSFT"; const string notFoundMessage = "Not Found"; var mock = new Mock <IStockReturns>(); var settings = new ConfigurationVariables() { MaxDaysInDateRange = 365 }; var configurationVariables = Options.Create(settings); decimal?alphaValue = null; var alphaValueWithMessage = (alphaValue, notFoundMessage); mock.Setup(d => d.GetAlphaValueBySymbolOverDateRangeAsync(stockSymbol, benchmarkSymbol, It.IsAny <DateTime?>(), It.IsAny <DateTime?>())).ReturnsAsync(alphaValueWithMessage); var controller = new AlphaController(mock.Object, configurationVariables); // Act var result = controller.Get(stockSymbol, benchmarkSymbol).Result.Result; // Assert Assert.IsType <NotFoundResult>(result); }
// Start is called before the first frame update void Start() { alpha = GetComponent <AlphaController>(); move = GetComponent <PlayerMove>(); life = GetComponent <Life>(); myLight = GetComponent <LightController>(); contactTime = 0.0f; }
void Start() { alphaController = gameObject.GetComponent <AlphaController>(); if (!inRoom) { // initialize to be invisible alphaController.setAlpha(0.0f); gameObject.SetActive(false); Color newColor = tiles.color; newColor.a = 0.0f; tiles.color = newColor; } }
void QuoteEnter(QuoteStyles styles, int ctrlIndex) { switch (styles.quoteStyle) { case QuoteStyle.OnlyOne: quoteCtrl[ctrlIndex].PlaceQuoteOnBone(styles); if (quoteCtrl[ctrlIndex].list.Count > 0) { while (quoteCtrl[ctrlIndex].list.Count != 0) { QuoteExit(quoteCtrl[ctrlIndex].list[0], ctrlIndex); } } break; case QuoteStyle.Time: quoteCtrl[ctrlIndex].PlaceQuoteOnBone(styles); StartCoroutine(this.DelayMethod(3f, () => { QuoteExit(styles, ctrlIndex); })); break; case QuoteStyle.List: if (quoteCtrl[ctrlIndex].list.Count > styles.ListMax - 1) { QuoteExit(quoteCtrl[ctrlIndex].list[0], ctrlIndex); } quoteCtrl[ctrlIndex].UpdateList(styles); break; default: break; } switch (styles.alphaStyle) { case AlphaStyle.AlphaAlpha: case AlphaStyle.AlpahDefault: AlphaController alpha = styles.panel.gameObject.AddComponent <AlphaController>(); alpha.Init(styles.alphaTime, 0, false); break; } if (styles.moveDirection != Vector3.zero) { RectPositionMover rect = styles.panel.gameObject.AddComponent <RectPositionMover>(); rect.Init(-styles.moveDirection, Vector3.zero, 0, styles.moveTime); } quoteCtrl[ctrlIndex].list.Add(styles); }
void OnTriggerEnter(Collider coll) { if (coll.tag == reqObj) // player has brought the required Buildable to this location { buildable = coll.gameObject; } if (coll.tag == "AlphaConstruct") // player is trying to Build { if (buildable) { AlphaController alpha = GameObject.FindObjectOfType <AlphaController>(); if (alpha) { alpha.animator.primary(); } ConstructObj(); } } }
void QuoteExit(QuoteStyles styles, int ctrlIndex) { quoteCtrl[ctrlIndex].list.Remove(styles); switch (styles.alphaStyle) { case AlphaStyle.AlphaAlpha: case AlphaStyle.DefaultAlpha: AlphaController alpha = styles.panel.gameObject.AddComponent <AlphaController>(); alpha.Init(styles.alphaTime, 0, true); styles.panel.gameObject.AddComponent <AlphaDestroy>(); break; default: Debug.Log("Delete"); Destroy(styles.panel.gameObject, styles.alphaTime >= styles.moveTime ? styles.alphaTime : styles.moveTime); break; } if (styles.moveDirection != Vector3.zero) { RectPositionMover rect = styles.panel.gameObject.AddComponent <RectPositionMover>(); rect.Init(Vector3.zero, styles.moveDirection, 0, styles.moveTime); } }
private void Start() { AlphaController alpha = GetComponent <AlphaController>(); alpha.Action = this; }
readonly float RiseLength = 0.05f; // 撃破されたときの上昇距離 // Start is called before the first frame update virtual protected void Start() { rigid = GetComponent <Rigidbody2D>(); life = GetComponent <Life>(); alpha = GetComponent <AlphaController>(); }