public override ADL_CurrentItemCategory MapCurrentItemCategorytoDLCurrentItemCategory(CurrentItemCategory currentitemcategory) { var result = new DL_CurrentItemCategory(); result.Name = currentitemcategory.Name; result.Description = currentitemcategory.Description; result.VAT = currentitemcategory.VAT; return(result); }
public void RetrieveItemCategory_HappyPath() { //ARRANGE var svc = new Implementation.BBService(); svc.MockCurrentItemCategories = true; var category1 = new DL_CurrentItemCategory(); category1.Id = Common.CATEGORY1_ID; category1.Description = Common.CATEGORY1_DESCRIPTION; category1.Name = Common.CATEGORY1_NAME; category1.VAT = Common.CATEGORY1_VAT; var category2 = new DL_CurrentItemCategory(); category2.Id = Common.CATEGORY2_ID; category2.Description = Common.CATEGORY2_DESCRIPTION; category2.Name = Common.CATEGORY2_NAME; category2.VAT = Common.CATEGORY2_VAT; MockDatabase.MockedDb.Add(category1); MockDatabase.MockedDb.Add(category2); //ACT var result = svc.RetrieveItemCategories(new DataContracts.RetrieveItemCategoriesRequest()); //ASSERT Assert.AreEqual(0, result.CallResult); Assert.IsTrue(String.IsNullOrEmpty(result.Message)); var returnedCategory1 = (DataContracts.CurrentItemCategory)result.Categories.Where(x => x.Id == Common.CATEGORY1_ID).SingleOrDefault(); Assert.AreEqual(Common.CATEGORY1_NAME, returnedCategory1.Name); Assert.AreEqual(Common.CATEGORY1_DESCRIPTION, returnedCategory1.Description); Assert.AreEqual(Common.CATEGORY1_VAT, returnedCategory1.VAT); var returnedCategory2 = (DataContracts.CurrentItemCategory)result.Categories.Where(x => x.Id == Common.CATEGORY2_ID).SingleOrDefault(); Assert.AreEqual(Common.CATEGORY2_NAME, returnedCategory2.Name); Assert.AreEqual(Common.CATEGORY2_DESCRIPTION, returnedCategory2.Description); Assert.AreEqual(Common.CATEGORY2_VAT, returnedCategory2.VAT); }