예제 #1
0
        public UnitTest1()
        {
            var options = new DbContextOptionsBuilder <HighscoreContext>().UseCosmos("https://cosmosdbstadler.documents.azure.com:443",
                                                                                     "2p0GxSmhfq07FtMrjS5pyWDJi5ZMfMqb0B413XdpKU2QgYplUqY1oDs3LOBvHtGaknsSIt4jIhvlXLQejSqXvg==", "HighscoreExercise").Options;

            dataContext = new HighscoreContext(options);
            controller  = new HighscoresController(dataContext, Mock.Of <IConfiguration>());
        }
        public HighscoreTests()
        {
            var options = new DbContextOptionsBuilder <DataContext>().
                          UseSqlServer("Server=KATRIN-BOOK;Database=Highscore;Integrated Security=SSPI;")
                          .Options;

            _context    = new DataContext(options);
            _controller = new HighscoresController(_context);
        }
예제 #3
0
 public static void ClassInitialize(TestContext context)
 {
     _context = new DatabaseContext("Server=(localdb)\\mssqllocaldb;Database=YoutubeGuesserApiDB_Tests;Trusted_Connection=True;MultipleActiveResultSets=true");
     _context.Profanities.Add(new Profanity("f**k"));
     _context.Highscores.Add(new Highscore("alias", 5, "location"));
     _context.Highscores.Add(new Highscore("alias2", 3, "location"));
     _context.Highscores.Add(new Highscore("alias3", 6, "location"));
     _context.SaveChanges();
     highscoresController = new HighscoresController(_context);
 }
예제 #4
0
    new void OnEnable()
    {
        base.OnEnable();
        GameScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
        Grade      = transform.Find("Grade").gameObject;
        if (GameScript.points < 100)
        {
            Grade.GetComponent <Image>().sprite = GradeSprites[1];
            Grade.GetComponent <Animator>().SetBool("GradeB", true);
        }
        else if (GameScript.points < 200)
        {
            Grade.GetComponent <Image>().sprite = GradeSprites[2];
            Grade.GetComponent <Animator>().SetBool("GradeA", true);
        }
        else
        {
            Grade.GetComponent <Image>().sprite = GradeSprites[0];
            Grade.GetComponent <Animator>().SetBool("GradeS", true);
        }

        HighscoresScript = GameObject.FindGameObjectWithTag("HighscoreController").GetComponent <HighscoresController>();

        CurrentScore = transform.Find("Score").GetComponent <Text>();
        HighScore    = transform.Find("Highscore").GetComponent <Text>();

        HighScore.text    = HighscoresScript.IsNewHighscore(GameScript.points).ToString();
        CurrentScore.text = GameScript.points.ToString();



        if (PlayerPrefs.HasKey("Money"))
        {
            PlayerPrefs.SetInt("Money", PlayerPrefs.GetInt("Money") + GameScript.points);
        }
        else
        {
            PlayerPrefs.SetInt("Money", GameScript.points);
        }
    }