public void ShouldProduceValidContentResultWhenServiceAvailableAsync() { var petApiServiceMock = new Mock <IPetApiService>(); petApiServiceMock.Setup(s => s.LoadPetOwners()).Returns( Task.FromResult <List <PetOwner> >(new List <PetOwner> { new PetOwner { Gender = "female", Pets = new List <Pet> { new Pet { Name = "Rock", Type = "Dog" }, new Pet { Name = "Ket", Type = "Cat" } } } })); var logCatControllerMock = new Mock <ILogger <CatController> >(); var catController = new CatController(petApiServiceMock.Object, logCatControllerMock.Object); var content = catController.GetCatNamesByOwnerGender(); var expected = "<html><body><h5>female</h5><ul><li>Ket</li></ul></body></html>"; Assert.AreEqual(expected, content.Result.Content.ToString()); }
public async Task GetCatBySecondaryId_ForSecondaryId_Successful() { var lastCat = Cats.LastOrDefault(); var cat = await CatController.GetBySecondaryId(lastCat.SecondaryId); cat.Id.Should().Be(lastCat.Id); }
private void Awake() { player = FindObjectOfType <CatController>(); backgroundStepZero = Resources.Load("Prefabs/BackgroundStepZero") as GameObject; backgroundStepOne = Resources.Load("Prefabs/BackgroundStepOne") as GameObject; backgroundStepTwo = Resources.Load("Prefabs/BackgroundStepTwo") as GameObject; }
public void OneTimeSetUp() { Setup.Bootstrap(SetupType.Test); CreateCatTestData(); var catRepository = new Mock <ICatRepository>(); // Setup the cat repository catRepository.Setup(x => x.GetAll()).Returns(Task.FromResult(Cats.AsEnumerable())); catRepository.Setup(x => x.GetById(It.IsAny <Guid>())) .Returns((Guid id) => { return(Task.FromResult(Cats.FirstOrDefault(x => x.Id == id))); }); catRepository.Setup(x => x.GetBySecondaryId(It.IsAny <Guid>())) .Returns((Guid id) => { return(Task.FromResult(Cats.FirstOrDefault(x => x.SecondaryId == id))); }); catRepository.Setup(x => x.Create(It.IsAny <Cat>())) .Returns((Cat entity) => { Cats.Add(entity); return(Task.CompletedTask); }); catRepository.Setup(x => x.Delete(It.IsAny <Guid>())) .Returns((Guid id) => { Cats.Remove(Cats.FirstOrDefault(x => x.Id == id)); return(Task.CompletedTask); }); CatController = new CatController(catRepository.Object); }
public async Task GetAll_Cats_Successful() { var entities = await CatController.GetAll(); var enumerable = entities as Cat[] ?? entities.ToArray(); enumerable.Count().Should().Be(Cats.Count); }
public async Task GetAll_Cats_Successful() { var result = await CatController.GetAll() as OkObjectResult; var entities = result.Value as IEnumerable <Cat>; entities.Count().Should().Be(TestData.Cats.Count); }
public async Task GetCats_ShouldNotFind() { var controller = new CatController(); var cats = await controller.GetCatsAsync(); //Assert Assert.IsNotNull(cats); }
public async Task Delete_Cat_Successful() { var cat = Cats.FirstOrDefault(); await CatController.Delete(cat.Id); Cats.FirstOrDefault(x => x.Id == cat.Id).Should().BeNull(); }
public void drainPower(float dt, CatController controler) { power -= dt * ratio * 10; Camera.main.GetComponent<CameraController>().shake = (100 - power) / 1000; if (power <= 0) { exorcise(); controler.stopSleeping(); } }
public void GetPets_CheckInEmptyList() { var controller = new CatController(); List <Person> persons = null; List <OwnersPet> cats = controller.GetPets(persons, "Cat"); // Assert Assert.IsNull(cats); }
public void GetPets_CheckForAllPets() { var controller = new CatController(); List <Person> persons = GetTestPersons(); List <OwnersPet> cats = controller.GetPets(persons, ""); // Assert Assert.AreEqual(10, cats.Count); }
// Start is called before the first frame update void Awake() { me = this; cc = GetComponent <CharacterController>(); pc = GetComponentInChildren <Camera>(); attackBC = GetComponentInChildren <BoxCollider>(); aS = GetComponent <AudioSource>(); camOgPos = pc.transform.localPosition; }
private void Awake() { player = FindObjectOfType <CatController>(); scoreProcessText = GameObject.Find("Score Process").GetComponent <Text>(); medalScoreText = GameObject.Find("Medal Score").GetComponent <Text>(); strawberryScoreText = GameObject.Find("Strawberry Score").GetComponent <Text>(); highScoreText = GameObject.Find("High Score").GetComponent <Text>(); playButton = GameObject.Find("Play Button").GetComponent <Button>(); }
public async Task GetCatBySecondaryId_ForSecondaryId_Successful() { var lastCat = TestData.Cats.LastOrDefault(); var result = await CatController.GetBySecondaryId(lastCat.SecondaryId) as OkObjectResult; var cat = result.Value as Cat; cat.Id.Should().Be(lastCat.Id); }
void Start() { spawnBehaviour = FindObjectOfType <SpawnBehaviour>(); sceneControl = FindObjectOfType <SceneController>(); gameSettings = FindObjectOfType <GameSettings>(); uiManager = FindObjectOfType <UiManager>(); catController = FindObjectOfType <CatController>(); currentSpeed = gameSettings.SpeedSet; }
public void Killed() { CatController controller = m_gameObject.GetComponent(typeof(CatController)) as CatController; if (controller != null) { controller.CurrentState = StateStealthKillToDeath.GetState(); } }
public override void Stroke(CatController cat) { //реакция: мурлычет //настроение: отличное cat.textDisplay.startShowingText("Ваш кот мурлычет..."); cat.fadeInOut.StartFadeInOut(cat.fadeInOut.goodSprite, cat.fadeInOut.excellentSprite); cat.emmitParticles.StartEmmitParticles(Mood.EXCELLENT); cat.indicateMood.ChangeMood(Mood.EXCELLENT); cat.TransitionToState(cat.ExcellentState); }
public override void Feed(CatController cat) { //реакция: все съедает, но если в это время подойти - поцарапает //настроение: хорошее cat.textDisplay.startShowingText("Ваш кот ест, лучше пока к нему не подходить..."); cat.fadeInOut.StartFadeInOut(cat.fadeInOut.badSprite, cat.fadeInOut.goodSprite); cat.emmitParticles.StartEmmitParticles(Mood.EXCELLENT); cat.indicateMood.ChangeMood(Mood.GOOD); cat.TransitionToState(cat.GoodState); }
/// <summary> /// Applies damage in case we touch the cat. /// </summary> /// <param name="other"></param> private void OnTriggerStay(Collider other) { CatController cat = other.GetComponent <CatController>(); if (cat != null && Time.time >= nextDamage) { nextDamage = Time.time + damageInterval; cat.ApplyDamage(damage); } }
public void GetPets_CheckForInvalidPetType() { var controller = new CatController(); List <Person> persons = GetTestPersons(); List <OwnersPet> pets = controller.GetPets(persons, "NotaPet"); // Assert Assert.IsNotNull(pets); Assert.AreEqual(0, pets.Count); }
public override void Kick(CatController cat) { //реакция: убегает на ковер и писает //настроение: плохое cat.textDisplay.startShowingText("Ваш кот убегает на ковер и писает..."); cat.fadeInOut.StartFadeInOut(cat.fadeInOut.goodSprite, cat.fadeInOut.badSprite); cat.emmitParticles.StartEmmitParticles(Mood.ANGRY); cat.indicateMood.ChangeMood(Mood.ANGRY); cat.TransitionToState(cat.BadState); }
void OnTriggerEnter2D(Collider2D other) { CatController c = other.GetComponent <CatController> (); if (c != null && !used) { c.SetSpawnPt(respawnPt.position); sp.sprite = FlagUp; used = true; } }
public override bool OnRunning(BTTreeRuntimePack _runtimePack) { CatController controller = _runtimePack.GameObject.GetComponent( typeof(CatController)) as CatController; if (controller != null) { controller.m_wantKill = true; } return(true); }
public async Task Update_Cat_Successful() { var cat = Cats.FirstOrDefault(); var newName = Guid.NewGuid().ToString(); cat.Name = newName; await CatController.Put(cat); Cats.FirstOrDefault(x => x.Name == newName).Should().NotBeNull(); }
public async Task Create_Cat_Successful() { var cat = new Cat() { Id = Guid.NewGuid(), Name = Guid.NewGuid().ToString() }; await CatController.Post(cat); Cats.FirstOrDefault(x => x.Id == cat.Id).Should().BeEquivalentTo(cat); }
/// <summary> /// Checks if we hit the cat, meaning that we were catched. /// </summary> /// <param name="other"></param> private void OnTriggerEnter(Collider other) { CatController cat = other.GetComponent <CatController>(); if (cat != null) { SpawnParticles(); OnCatchedByCat.Invoke(); Destroy(gameObject); } }
// ----------------------------------------------------------------- public void Init(CatController catController) { this.catController = catController; foreach (CatAction action in Enum.GetValues(typeof(CatAction))) { GameObject obj = Instantiate(slotInstance, transform); ActionButton actionButton = obj.GetComponent <ActionButton>(); actionButton.Init(action, OnActionButtonClick); } }
private void Start() { float distance = Mathf.Abs(Camera.main.transform.position.z); var frustumHeight = distance * Mathf.Tan(Camera.main.fieldOfView * 0.5f * Mathf.Deg2Rad); var frustumWidth = -frustumHeight * Camera.main.aspect; translatePosition = new Vector3(frustumWidth, frustumHeight, 0f); randomStart = Random.Range(0.0f, Mathf.PI); startPosition = transform.position.y; GameObject cat = GameObject.FindGameObjectWithTag("Player"); this.catController = cat.GetComponent<CatController> (); }
// Update is called once per frame void Update() { if (Time.time > t1) { t1 += 10000000; GameObject a = Instantiate(bluePrefab, new Vector2(-9.3f, 11.27f), new Quaternion(0f, 0f, 0f, 0f)); CatController behavoir = a.GetComponent(typeof(CatController)) as CatController; behavoir.targetObject = this.gameObject; } if (Time.time > t2) { t2 += 10000000; GameObject a = Instantiate(bluePrefab, new Vector2(-9.3f, 11.27f), new Quaternion(0f, 0f, 0f, 0f)); CatController behavoir = a.GetComponent(typeof(CatController)) as CatController; behavoir.targetObject = this.gameObject; } if (Time.time > t3) { t3 += 10000000; GameObject a = Instantiate(greenPrefab, new Vector2(-9.43f, 14.8f), new Quaternion(0f, 0f, 0f, 0f)); CatController behavoir = a.GetComponent(typeof(CatController)) as CatController; behavoir.targetObject = this.gameObject; } if (Time.time > t4) { t4 += 10000000; GameObject a = Instantiate(greenPrefab, new Vector2(-9.43f, 14.8f), new Quaternion(0f, 0f, 0f, 0f)); CatController behavoir = a.GetComponent(typeof(CatController)) as CatController; behavoir.targetObject = this.gameObject; } if (Time.time > t5) { t5 += 10000000; GameObject a = Instantiate(pinkPrefab, new Vector2(-9.4f, 18f), new Quaternion(0f, 0f, 0f, 0f)); CatController behavoir = a.GetComponent(typeof(CatController)) as CatController; behavoir.targetObject = this.gameObject; } if (Time.time > t6) { t6 += 10000000; GameObject a = Instantiate(pinkPrefab, new Vector2(-9.4f, 18f), new Quaternion(0f, 0f, 0f, 0f)); CatController behavoir = a.GetComponent(typeof(CatController)) as CatController; behavoir.targetObject = this.gameObject; } if (Time.time > tplayer) { tplayer += 10000000; Instantiate(playerPrefab, new Vector2(-9.4f, 13.8f), new Quaternion(0f, 0f, 0f, 0f)); MiniSpawnManager.SetActive(false); s.Activate(); } }
public override void Update(UpdateParamater updatePara, CatController cc) { if (!greeting) { greeting = true; greetingMsg = memorialDays.GetDay((uint)DateTime.Today.Month, (uint)DateTime.Today.Day).HandledDescription; } if (cc.Execute(cc.Commands["Greet"], new string[] { greetingMsg })) { greeting = false; } }
public void ResetGame() { Destroy(Dustbox.instance.gameObject); CatController cat = GameObject.FindObjectOfType(typeof(CatController)) as CatController; cat.Reset(); RandomSpawn spawn = GameObject.FindObjectOfType(typeof(RandomSpawn)) as RandomSpawn; spawn.enabled = true; }
IEnumerator handleConfigureSession(WWW _www) { yield return _www; if (_www.text == "cat1") { currentCat = cat1; otherCat = cat2; } else { currentCat = cat2; otherCat = cat1; } SendPosition(); }
// Use this for initialization void Start () { Debug.Log ("CatController Start"); instance = this; lane = 0; canMoveLeft = true; canMoveRight = true; inDanzerZone = false; eatenPowerPellet = false; gettingPushed = false; /* middleSprite = transform.FindChild ("middleSprite").gameObject; leftSprite = transform.FindChild ("leftSprite").gameObject; rightSprite = transform.FindChild ("rightSprite").gameObject; */ }
private void death(CatController loserCat) { ParticleSystem death = GameObject.Find("Death").GetComponent<ParticleSystem>(); death.Play(); death.transform.position = new Vector3(loserCat.transform.position.x, loserCat.transform.position.y, death.transform.position.z); }
// Use this for initialization void Start() { catController = transform.parent.GetComponent<CatController>(); }
void Awake() { controller = GetComponent<CatController>(); move = GetComponent<Move>(); anim = GetComponent<Animator>(); }