コード例 #1
0
        public async Task CanBringBackTheIssue()
        {
            _controller = new IssuesController(_context, _mapper);
            _controller.ControllerContext = TestInitializer.GetContext();

            string _projectName = "Velocity";
            string _screenName  = "Install";
            string _locale      = "pl-PL";

            //var result = await _controller.Get(_projectName) as OkObjectResult;
            var OkObjectTask = _controller.Get(_projectName, _screenName, _locale);

            OkObjectTask.Wait();

            var result = OkObjectTask.Result as OkObjectResult;

            Assert.IsNotNull(result);

            var issues = result.Value as ICollection <IssueDto>;

            Assert.IsNotNull(issues);

            Assert.IsTrue(issues.Count == 2);


            // update old issue

            string _build = "1.0";

            CreateIssueDto newIssue = new CreateIssueDto {
                Text = "C0rrpu4Ed!", Severity = IssueSeverity.Error, Type = IssueType.CharacterCorruption
            };

            var OkObjectTask2 = _controller.Post(_projectName, _screenName, _locale, _build, newIssue);

            OkObjectTask2.Wait();

            var result2 = OkObjectTask2.Result as CreatedAtRouteResult;

            Assert.IsNotNull(result2);



            // check if it is not visible

            var OkObjectTask3 = _controller.Get(_projectName, _screenName, _locale);

            OkObjectTask3.Wait();

            var result3 = OkObjectTask3.Result as OkObjectResult;

            Assert.IsNotNull(result3);

            var issues3 = result3.Value as ICollection <IssueDto>;

            Assert.IsNotNull(issues3);

            Assert.IsTrue(issues3.Count == 3);
        }
コード例 #2
0
        public async Task IssuesControllerGet_WithoutParams_Should_ReturnAllIssues()
        {
            var expected = await _mockRepo.GetBugAll(_cts.Token);

            var result = await _controller.Get(_cts.Token);

            var objResult = (ObjectResult)result;
            var response  = (SuccessResult)objResult.Value;

            var actual = response.Results;

            Assert.AreEqual(objResult.StatusCode, 200);
            Assert.IsTrue(response.Status == "Successful");
            Assert.AreEqual(expected.Length, actual.Length);
        }
コード例 #3
0
        public async Task CanGetIssues()
        {
            _controller = new IssuesController(_context, _mapper);

            string _projectName = "Velocity";
            string _screenName  = "Install";
            string _locale      = "pl-PL";

            //var result = await _controller.Get(_projectName) as OkObjectResult;
            var OkObjectTask = _controller.Get(_projectName, _screenName, _locale);

            OkObjectTask.Wait();

            var result = OkObjectTask.Result as OkObjectResult;

            Assert.IsNotNull(result);

            var issues = result.Value as ICollection <IssueDto>;

            Assert.IsNotNull(issues);

            Assert.IsTrue(issues.Count == 2);

            var OkObjectTaskAll = _controller.Get(_projectName, _screenName, _locale, false);

            OkObjectTaskAll.Wait();

            var resultAll = OkObjectTaskAll.Result as OkObjectResult;

            Assert.IsNotNull(resultAll);

            var issuesAll = resultAll.Value as ICollection <IssueDto>;

            Assert.IsNotNull(issuesAll);

            Assert.IsTrue(issuesAll.Count == 3);
        }