Esempio n. 1
0
        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);
        }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
        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);
        }
Esempio n. 7
0
        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();
        }
Esempio n. 9
0
	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();
		}
	}
Esempio n. 10
0
        public void GetPets_CheckInEmptyList()
        {
            var              controller = new CatController();
            List <Person>    persons    = null;
            List <OwnersPet> cats       = controller.GetPets(persons, "Cat");

            // Assert
            Assert.IsNull(cats);
        }
Esempio n. 11
0
        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;
 }
Esempio n. 13
0
 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);
        }
Esempio n. 15
0
 void Start()
 {
     spawnBehaviour = FindObjectOfType <SpawnBehaviour>();
     sceneControl   = FindObjectOfType <SceneController>();
     gameSettings   = FindObjectOfType <GameSettings>();
     uiManager      = FindObjectOfType <UiManager>();
     catController  = FindObjectOfType <CatController>();
     currentSpeed   = gameSettings.SpeedSet;
 }
Esempio n. 16
0
        public void Killed()
        {
            CatController controller = m_gameObject.GetComponent(typeof(CatController)) as CatController;

            if (controller != null)
            {
                controller.CurrentState = StateStealthKillToDeath.GetState();
            }
        }
Esempio n. 17
0
 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);
 }
Esempio n. 18
0
 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);
 }
Esempio n. 19
0
    /// <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);
        }
    }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
 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);
 }
Esempio n. 22
0
    void OnTriggerEnter2D(Collider2D other)
    {
        CatController c = other.GetComponent <CatController> ();

        if (c != null && !used)
        {
            c.SetSpawnPt(respawnPt.position);
            sp.sprite = FlagUp;
            used      = true;
        }
    }
Esempio n. 23
0
        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);
        }
Esempio n. 26
0
    /// <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);
        }
    }
Esempio n. 27
0
        // -----------------------------------------------------------------
        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);
            }
        }
Esempio n. 28
0
    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> ();
    }
Esempio n. 29
0
    // 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();
        }
    }
Esempio n. 30
0
 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;
     }
 }
Esempio n. 31
0
    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();
    }
Esempio n. 33
0
	// 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);
     
 }
Esempio n. 35
0
 // Use this for initialization
 void Start()
 {
     catController = transform.parent.GetComponent<CatController>();
 }
Esempio n. 36
0
 void Awake()
 {
     controller = GetComponent<CatController>();
     move = GetComponent<Move>();
     anim = GetComponent<Animator>();
 }