コード例 #1
0
        private static List<DpiNotesDto> MapResponse(retrieveCustomerAccountMemosResponse1 esbResponse)
        {
            var dpiNotes = new List<DpiNotesDto>();

            if (null == esbResponse ||
                null == esbResponse.retrieveCustomerAccountMemosResponse ||
                null == esbResponse.retrieveCustomerAccountMemosResponse.retrieveCustomerAccountMemosOutput ||
                null == esbResponse.retrieveCustomerAccountMemosResponse.retrieveCustomerAccountMemosOutput.Payload)
            {
                return dpiNotes;
            }

            foreach (
                var m in esbResponse
                    .retrieveCustomerAccountMemosResponse
                    .retrieveCustomerAccountMemosOutput
                    .Payload)
            {
                var note = new DpiNotesDto
                {
                    TemplateName = m.templateName,
                    TemplateDescription = m.templateDescription,
                    NoteType = m.type
                };
                foreach (var txt in m.RawText)
                {
                    note.Description += txt.textLine + Environment.NewLine;
                }

                note.CreatedBy = m.createdBy;
                note.CreatedDate = m.createdDate;

                dpiNotes.Add(note);
            }
            return dpiNotes;
        }
コード例 #2
0
        public void SIMPL_Successfully_Displays_Memos_From_DPI()
        {
            using (ShimsContext.Create())
            {
                #region Initialize
                SIMPLTestContext testContext = new SIMPLTestContext();
                var session = GetShimmedSession();

                var context = new ShimHttpContext();
                ShimHttpContext.CurrentGet = () => context;
                ShimHttpContext.AllInstances.SessionGet = (o) => session;

                ShimCurrentSubscriber.GetInstance = () => new ShimCurrentSubscriber
                {
                    DataProductTypeGet = () => SubscriberEnums.DataProductType.XDsl,
                    VideoProductTypeGet = () => SubscriberEnums.VideoProductType.IpTv,
                    StateGet = () => "CT",
                    WtnGet = () => "5852659033",
                    DpiRegionGet = () => "LR",
                    ProvisionedServicesListGet = () => new List<ServiceDto>
                    {
                        new ServiceDto
                        {
                            Action = "None",
                            ClassName = "DATA - DSL SPEED",
                            Description = "12 MBPS/1.5 MBPS",
                            Name = "D12M1M",
                            Type = ServiceClassTypeDto.None,
                        },
                        new ServiceDto
                        {
                            Action = "None",
                            ClassName = "DSL - TECHNOLOGY CODE",
                            Description = "HSIA SERVICES",
                            Name = "VDSL",
                            Type = ServiceClassTypeDto.None
                        }
                    }
                };

                //Given a user
                //And user is authenticated to process Upsell submission
                var fakeUser = testContext.GetFakeUserDtoObject();
                ShimCurrentUser.AsUserDto = () => fakeUser;
                ShimCurrentUser.GetInstance = () => new ShimCurrentUser
                {
                    UniqueIdGet = () => "mjw425"
                };

                //Shim datasource request going from kendo grid
                var dataSourcerequest = new DataSourceRequest()
                {
                    Aggregates = new List<AggregateDescriptor>(),
                    Filters = new List<IFilterDescriptor>(),
                    Groups = new List<GroupDescriptor>(),
                    Page = 1,
                    PageSize = 0,
                    Sorts = new List<SortDescriptor>()
                };

                var fromDate = DateTime.Now.AddDays(-7).ToString();
                var toDate = DateTime.Now.AddDays(7).ToString();

                var defaultFilterAsJson =
                    "{'NoteTypes':['DPI'],'IsCustomDate':true,'FromDateRange':'" + fromDate + "','ToDateRange':'" + toDate + "','SubscriberId':'130000990344','LocationId':'1319028645001'}";

                #endregion

                //shim the expected esb response from the service.
                #region ESB Response

                var createdDate = DateTime.Now;
                var response = new retrieveCustomerAccountMemosResponse1()
                        {
                            retrieveCustomerAccountMemosResponse = new retrieveCustomerAccountMemosResponse()
                            {
                                retrieveCustomerAccountMemosOutput = new msg_Memo()
                                {
                                    Payload = new Memo[]
                            {
                                new Memo()
                                {
                                    templateName = "RSSOS",
                                    templateDescription = "ROCHESTER SPECIAL SVS ORDER",
                                    type = "BasicMemo",
                                    RawText = new RawText[]
                                    {
                                        new RawText()
                                        {
                                            textLine = "20081209 61825 Add RSSOS memos for Access Lines per Scrub C.24358"
                                        }
                                    },
                                    createdBy = "CONVER",
                                    createdDate = createdDate
                                },

                                new Memo()
                                {
                                    templateName = "RSSOS",
                                    templateDescription = "ROCHESTER SPECIAL SVS ORDER",
                                    type = "BasicMemo",
                                    RawText = new RawText[]
                                    {
                                        new RawText()
                                        {
                                            textLine = "SERVICE ORDER#: 002371328"
                                        }
                                    },
                                    createdBy = "CONVER",
                                    createdDate = createdDate
                                },
                                new Memo()
                                {
                                    templateName = "RSSOS",
                                    templateDescription = "ROCHESTER SPECIAL SVS ORDER",
                                    type = "BasicMemo",
                                    RawText = new RawText[]
                                    {
                                        new RawText()
                                        {
                                            textLine = "SO: CD/002371326 2/17/2014 IssBy: 77777 SldBy: 0"
                                        }
                                    },
                                    createdBy = "CONVER",
                                    createdDate = createdDate
                                }

                            }
                                }
                            }
                        };
                #endregion

                //Shim call to the service
                ShimCustomerInformationInquiryClient.AllInstances
                    .SIMPLDALCustomerInformationInquiryCustomerInformationInquiryretrieveCustomerAccountMemosretrieveCustomerAccountMemosRequest
                    =
                    delegate { return response; };

                var result = NotesControllerForTest.GetNotes(dataSourcerequest, defaultFilterAsJson) as JsonResult;

                //was data returned?
                Assert.IsNotNull(result, "Resultset contains no memos/notes");

                var notes = (List<NotesViewModel>)(result.Data as DataSourceResult ?? new DataSourceResult()).Data;

                //validate the proper conversion
                Assert.IsNotNull(notes, "No notes data after conversion");

                //Then the Memos are fetched from the DPI System
                Assert.AreEqual(notes.Count,
                    response.retrieveCustomerAccountMemosResponse.retrieveCustomerAccountMemosOutput.Payload.Length,
                    string.Format("The returned notes data does not match. Expected notes count: {0}, Actual notes count: {1})", notes.Count, response.retrieveCustomerAccountMemosResponse.retrieveCustomerAccountMemosOutput.Payload.Length));

                //just get the single note obj for following asserts
                var singleNote = notes[0];

                //And date and time of the memos is displayed
                Assert.AreNotEqual(string.Empty, singleNote.DateTime.ToString(),
                    string.Format("No datetime was retured from the DPI. Actual: {0}", singleNote.DateTime.ToString()));

                //And user who entered the memos is displayed
                Assert.AreNotEqual(string.Empty, singleNote.User,
                    string.Format("No User was retured from the DPI. Actual: {0}", singleNote.User));

                //And source column displays DPI indicating the source of the memos
                Assert.AreEqual("DPI", singleNote.Source,
                string.Format("Source column does not match.Expected:'DPI', Actual: {0}", singleNote.Source));

                //And description of the memos is displayed in Notes column
                Assert.AreNotEqual(string.Empty, singleNote.Notes,
                string.Format("No notes desciption is available.Retured notes description: {0}", singleNote.Notes));
            }
        }