Esempio n. 1
0
 public void RockstarTestsSetUp()
 {
     testObj                   = new GameObject();
     testObj_rockstar          = testObj.AddComponent <Rockstar>() as Rockstar;
     testObj_rockstar.rockstar = new GameObject().AddComponent <Animator>();
     testObj_rockstar.Init("imaseed", 0f, 10f);
 }
Esempio n. 2
0
        public void MessageRockstar(Rockstar rockstar, string message)
        {
            _logger.LogDebug("Sending a message to {@rockstar}", rockstar);

            if (_random.Next(2) == 0)
            {
                throw new Exception("Woops.. random exception!");
            }
        }
Esempio n. 3
0
 public RockstarDTO(Rockstar rockstar)
 {
     FirstName   = rockstar.FirstName;
     LastName    = rockstar.LastName;
     PictureUrl  = rockstar.PictureUrl;
     Nationality = rockstar.Nationality;
     Region      = rockstar.Region.ToString();
     Birthday    = rockstar.Birthday;
 }
        public IActionResult Put([FromBody] Rockstar rockstar)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var updatedRockstar = _rockstarService.Update(rockstar);

            if (updatedRockstar == null)
            {
                return(NotFound());
            }
            var updatedRockstarDTO = new RockstarDTO(updatedRockstar);

            return(Ok(updatedRockstarDTO));
        }
        public IActionResult Post([FromBody] Rockstar rockstar)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var createdRockstar = _rockstarService.Create(rockstar);

            if (createdRockstar == null)
            {
                return(BadRequest());
            }
            var createdRockstarDTO = new RockstarDTO(createdRockstar);

            return(Ok(createdRockstarDTO));
        }
Esempio n. 6
0
        string render(Rockstar rockstar) => $@"
<h1>{Request.RawUrl}</h1>
<h2>{rockstar.FirstName} {rockstar.LastName}</h2>
<b>{rockstar.Age}</b>
";
Esempio n. 7
0
 public void RockstarTestsTearDown()
 {
     testObj_rockstar = null;
     testObj          = null;
 }