Exemple #1
0
            public void GetDocumentTextByBusinessPopulatesReturnObjectCorrectly()
            {
                dictionaryManager.Setup(x => x.GetDictionaryItemByKeysAndCultures(new List<string>
            {
                DictionaryConstants.GUESTMESSAGE + 1 + DictionaryConstants.GUESTMESSAGE_CANCELLATION,
                DictionaryConstants.GUESTMESSAGE + 1 + DictionaryConstants.GUESTMESSAGE_CONFIRMATION,
                DictionaryConstants.GUESTMESSAGE + 1 + DictionaryConstants.GUESTMESSAGE_GUESTREGISTRATION,
                DictionaryConstants.GUESTMESSAGE + 1 + DictionaryConstants.GUESTMESSAGE_INVOICE
            }, new List<string>
            {
                "root"
            }))
                  .Returns(new List<DictionaryDataItem>
                  {
                      new DictionaryDataItem
                      {
                          ItemKey = DictionaryConstants.GUESTMESSAGE + 1 + DictionaryConstants.GUESTMESSAGE_CONFIRMATION,
                          DictionaryInstances = new Collection<DictionaryInstance>
                          {
                              BusinessManager.GetBusinessDictionaryInstance("A", "root",
                                                                            DictionaryConstants
                                                                                .GUESTMESSAGE_CONFIRMATION, 1),
                          }
                      },
                      new DictionaryDataItem
                      {
                          ItemKey = DictionaryConstants.GUESTMESSAGE + 1 + DictionaryConstants.GUESTMESSAGE_CANCELLATION,
                          DictionaryInstances = new Collection<DictionaryInstance>
                          {
                              BusinessManager.GetBusinessDictionaryInstance("B", "root",
                                                                            DictionaryConstants
                                                                                .GUESTMESSAGE_CANCELLATION, 1),
                          }
                      },
                      new DictionaryDataItem
                      {
                          ItemKey = DictionaryConstants.GUESTMESSAGE + 1 + DictionaryConstants.GUESTMESSAGE_INVOICE,
                          DictionaryInstances = new Collection<DictionaryInstance>
                          {
                              BusinessManager.GetBusinessDictionaryInstance("C", "root",
                                                                            DictionaryConstants.GUESTMESSAGE_INVOICE, 1),
                          }
                      },
                      new DictionaryDataItem
                      {
                          ItemKey = DictionaryConstants.GUESTMESSAGE + 1 + DictionaryConstants.GUESTMESSAGE_GUESTREGISTRATION,
                          DictionaryInstances = new Collection<DictionaryInstance>
                          {
                              BusinessManager.GetBusinessDictionaryInstance("D", "root",
                                                                            DictionaryConstants
                                                                                .GUESTMESSAGE_GUESTREGISTRATION, 1)
                          }
                      }
                  });

                dictionaryManager.Setup(
                    x => x.DictionaryItemsToContent(It.IsAny<List<DictionaryDataItem>>(), It.IsAny<string>()))
                                 .Returns((List<DictionaryDataItem> dictionaryDataItems, string key)
                                          =>
                                     {
                                         var dm = new DictionaryManager();
                                         return
                                             dm.DictionaryItemsToContent(dictionaryDataItems, key
                                                 );
                                     });

                var documentText = businessManager.GetDocumentTextByBusiness(1, "root");

                Assert.AreEqual("A", documentText.Confirmation, "Unexpected value for Confirmation Text");
                Assert.AreEqual("B", documentText.Cancellation, "Unexpected value for Confirmation Text");
                Assert.AreEqual("C", documentText.Invoice, "Unexpected value for Confirmation Text");
                Assert.AreEqual("D", documentText.GuestRegistration, "Unexpected value for Confirmation Text");
                Assert.AreEqual("root", documentText.CultureCode, "Unexpected Value for Culture");
            }