示例#1
0
        public async Task CreateBusinessPartnerEmail_ValidUser_ContactInfoRetrieved()
        {
            // Arrange
            var user          = TestHelper.PaDev1;
            var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123");

            user.JwtEncodedString = loginResponse.Data.JwtAccessToken;
            user.JwtEncodedString.ShouldNotBeNullOrWhiteSpace();
            var request = new CreateEmailRequest
            {
                AccountID    = user.BPNumber.ToString(),
                Email        = user.Email,
                StandardFlag = true
            };

            if (request.Email == user.Email)
            {
                Assert.Fail("Bypass by debugging in order to avoid posting excess rows on server");
            }

            var contactInfoResponse = McfClient.GetBusinessPartnerContactInfo(user.JwtEncodedString, user.BPNumber.ToString());

            contactInfoResponse.Result.ShouldNotBeNull();
            var emails = contactInfoResponse.Result.AccountAddressIndependentEmails.Results.ToList();

            // Act
            var response = McfClient.CreateBusinessPartnerEmail(user.JwtEncodedString, request);

            // Assert
            response.Result.ShouldNotBeNull();
            response.Result.Metadata.Id.ShouldBe("https://10.41.53.54:8001/sap/opu/odata/sap/ZERP_UTILITIES_UMC_PSE_SRV/AccountAddressIndependentEmails(" +
                                                 $"AccountID=\'{user.BPNumber}\',SequenceNo=\'{emails.Count:D3}\')");
        }