Esempio n. 1
0
        public async Task CreateSummary2()
        {
            var builder = new SimpleTestHelperBuilderSummaryRights(Role.CustomerRole);

            using var helper = await builder.Build();

            var signIn = await helper.Helper.SignIn(new SignInRequest()
            {
                Username = builder.Costumer.Username,
                Password = helper.Helper.UsedPasswordForTests
            });

            helper.Helper.SetAuth(signIn);

            var issue = helper.Issue;
            IssueRequirement issueRequirement = new IssueRequirement()
            {
                Requirement = "Die Application Testen"
            };
            await helper.Helper.IssueRequirementService.CreateAsync(issue.Id, issueRequirement);

            var uri      = $"/api/issues/{issue.Id}/summaries";
            var response = await helper.client.PostAsync(uri, 1.0.ToStringContent());

            Assert.IsFalse(response.IsSuccessStatusCode);
        }
Esempio n. 2
0
        public async Task AcceptSummary3()
        {
            var builder = new SimpleTestHelperBuilderSummaryRights(Role.EmployeeRole);

            using var helper = await builder.Build();

            await helper.SetState(State.NegotiationState);

            var issue = helper.Issue;
            IssueRequirement issueRequirement = new IssueRequirement()
            {
                Requirement = "Die Application Testen"
            };
            await helper.Helper.IssueRequirementService.CreateAsync(issue.Id, issueRequirement);

            var uri      = $"/api/issues/{issue.Id}/summaries";
            var response = await helper.client.PostAsync(uri, 1.0.ToStringContent());

            Assert.IsTrue(response.IsSuccessStatusCode);

            var signIn = await helper.Helper.SignIn(new SignInRequest()
            {
                Username = builder.Costumer.Username,
                Password = helper.Helper.UsedPasswordForTests
            });

            helper.Helper.SetAuth(signIn);

            uri      = $"/api/issues/{issue.Id}/summaries?accept=true";
            response = await helper.client.PutAsync(uri, 1.0.ToStringContent());

            Assert.IsTrue(response.IsSuccessStatusCode);

            var newIssue = await helper.GetIssueAsync(issue.Id);

            Assert.IsTrue(newIssue.IssueDetail.RequirementsAccepted);

            Assert.AreEqual(State.ProcessingState, (await helper.Helper.GetStateById(newIssue)).Name);

            issueRequirement = new IssueRequirement()
            {
                Requirement = "Die Application Testen2"
            };
            uri      = $"/api/issues/{issue.Id}/requirements/";
            response = await helper.client.PostAsync(uri, issueRequirement.ToStringContent());

            Assert.IsFalse(response.IsSuccessStatusCode);
        }
Esempio n. 3
0
        public async Task DeclineSummary1()
        {
            var builder = new SimpleTestHelperBuilderSummaryRights(Role.CustomerRole);

            using var helper = await builder.Build();

            IssueRequirement issueRequirement = new IssueRequirement()
            {
                Requirement = "Die Application Testen"
            };
            await helper.Helper.IssueRequirementService.CreateAsync(helper.Issue.Id, issueRequirement);

            var uri      = $"/api/issues/{helper.Issue.Id}/summaries";
            var responce = await helper.client.PostAsync(uri, 1.0.ToStringContent());

            Assert.IsTrue(responce.IsSuccessStatusCode);

            var customerSignIn = await helper.Helper.SignIn(new SignInRequest()
            {
                Username = builder.Costumer.Username,
                Password = helper.Helper.UsedPasswordForTests
            });

            helper.Helper.SetAuth(customerSignIn);

            uri      = $"/api/issues/{helper.Issue.Id}/summaries?accept=false";
            responce = await helper.client.PutAsync(uri, 1.0.ToStringContent());

            Assert.IsTrue(responce.IsSuccessStatusCode);

            var issue = await helper.GetIssueAsync(helper.Issue.Id);

            Assert.IsFalse(issue.IssueDetail.RequirementsAccepted);
            Assert.IsFalse(issue.IssueDetail.RequirementsSummaryCreated);

            // Client is not allowed to post requirements!
            helper.Helper.SetAuth(helper.SignIn);

            issueRequirement = new IssueRequirement()
            {
                Requirement = "Die Application Testen2"
            };
            uri      = $"/api/issues/{issue.Id}/requirements/";
            responce = await helper.client.PostAsync(uri, issueRequirement.ToStringContent());

            Assert.IsTrue(responce.IsSuccessStatusCode);
        }
Esempio n. 4
0
        public async Task AcceptSummary2()
        {
            var builder = new SimpleTestHelperBuilderSummaryRights(Role.CustomerRole);

            using var helper = await builder.Build();

            var issue = helper.Issue;
            IssueRequirement issueRequirement = new IssueRequirement()
            {
                Requirement = "Die Application Testen"
            };
            await helper.Helper.IssueRequirementService.CreateAsync(issue.Id, issueRequirement);

            var uri      = $"/api/issues/{issue.Id}/summaries";
            var response = await helper.client.PostAsync(uri, 1.0.ToStringContent());

            Assert.IsTrue(response.IsSuccessStatusCode);

            uri      = $"/api/issues/{issue.Id}/summaries?accept=true";
            response = await helper.client.PutAsync(uri, 1.0.ToStringContent());

            Assert.IsFalse(response.IsSuccessStatusCode);
        }
Esempio n. 5
0
        public async Task DeclineSummary4()
        {
            var builder = new SimpleTestHelperBuilderSummaryRights(Role.EmployeeRole);

            using var helper = await builder.Build();

            IssueRequirement issueRequirement = new IssueRequirement()
            {
                Requirement = "Die Application Testen"
            };
            await helper.Helper.IssueRequirementService.CreateAsync(helper.Issue.Id, issueRequirement);

            var uri      = $"/api/issues/{helper.Issue.Id}/summaries";
            var responce = await helper.client.PostAsync(uri, 1.0.ToStringContent());

            Assert.IsTrue(responce.IsSuccessStatusCode);

            uri      = $"/api/issues/{helper.Issue.Id}/summaries?accept=false";
            responce = await helper.client.PutAsync(uri, 1.0.ToStringContent());

            Assert.IsTrue(responce.IsSuccessStatusCode);

            var issue = await helper.GetIssueAsync(helper.Issue.Id);

            Assert.IsFalse(issue.IssueDetail.RequirementsAccepted);
            Assert.IsFalse(issue.IssueDetail.RequirementsSummaryCreated);

            issueRequirement = new IssueRequirement()
            {
                Requirement = "Die Application Testen2"
            };
            uri      = $"/api/issues/{issue.Id}/requirements/";
            responce = await helper.client.PostAsync(uri, issueRequirement.ToStringContent());

            Assert.IsTrue(responce.IsSuccessStatusCode);
        }