コード例 #1
0
        public void builds_a_valid_request_when_valid_parameters_are_provided(string actionCategory, string actionCode,
                                                                              string username, string comment, string companyCode, string sessionToken, string tenancyAgreementRef)
        {
            var fakeCredentialsService = new Mock <ICredentialsService>();

            fakeCredentialsService.Setup(s => s.GetUhUserCredentials()).Returns(new UserCredential
            {
                UserName     = "******",
                UserPassword = "******"
            });
            fakeCredentialsService.Setup(s => s.GetUhSourceSystem()).Returns("TestSystem");
            var serviceRequestBuilder = new ArrearsServiceRequestBuilder(fakeCredentialsService.Object);
            var serviceRequest        = new ActionDiaryRequest
            {
                ActionCategory      = actionCategory,
                ActionCode          = actionCode,
                Username            = username,
                Comment             = comment,
                CompanyCode         = companyCode,
                SessionToken        = sessionToken,
                TenancyAgreementRef = tenancyAgreementRef
            };
            var request = serviceRequestBuilder.BuildNewActionDiaryRequest(serviceRequest);

            Assert.Equal(actionCategory, request.ArrearsAction.ActionCategory);
            Assert.Equal(actionCode, request.ArrearsAction.ActionCode);
            Assert.Equal(comment, request.ArrearsAction.Comment);
            Assert.Equal(tenancyAgreementRef, request.ArrearsAction.TenancyAgreementRef);
            Assert.Equal("testUser", request.DirectUser.UserName);
            Assert.Equal("testPassword", request.DirectUser.UserPassword);
            Assert.Equal("TestSystem", request.SourceSystem);
            Assert.Equal(sessionToken, request.SessionToken);
            Assert.Equal(companyCode, request.CompanyCode);
            Assert.NotEqual(username, request.DirectUser.UserName);
        }
コード例 #2
0
        public void return_a_built_request_object()
        {
            var fakeCredentialsService = new Mock <ICredentialsService>();
            var serviceRequestBuilder  = new ArrearsServiceRequestBuilder(fakeCredentialsService.Object);
            var serviceRequest         = new ActionDiaryRequest
            {
                ActionCategory      = "test",
                ActionCode          = "test",
                Username            = "******",
                Comment             = "test",
                CompanyCode         = "test",
                SessionToken        = "test",
                TenancyAgreementRef = "test"
            };
            var request = serviceRequestBuilder.BuildNewActionDiaryRequest(serviceRequest);

            Assert.IsType <ArrearsActionCreateRequest>(request);
        }