Ejemplo n.º 1
0
        public ContactAndHoursViewModel GetFullShopInformation()
        {
            var shopContact  = GetXmlModel <ShopContact>(GlobalXmlManager.ContactFileName);
            var openingHours = GetXmlModel <OpeningHours>(GlobalXmlManager.OpeningHoursFileName);
            ContactAndHoursViewModel viewModel = new ContactAndHoursViewModel()
            {
                Address   = shopContact.Address,
                Contact   = shopContact.Contact,
                WorksDays = openingHours.WorksDays
            };

            return(viewModel);
        }
Ejemplo n.º 2
0
        public void Contact()
        {
            // Arrange
            ContactAndHoursViewModel contactAndHoursViewModel = new ContactAndHoursViewModel()
            {
                Address = new Address()
                {
                    DeliveryContact    = "111 111 111",
                    Email              = "*****@*****.**",
                    InformationContact = "000 000 000"
                },
                Contact = new Contact()
                {
                    City       = "Poland",
                    PostalCode = "11-212",
                    Street     = "fake street"
                },
                WorksDays = new List <Days>()
                {
                    new Days()
                    {
                        Name = "Pon-Pt.", WorkHours = "8.00-22.00"
                    },
                    new Days()
                    {
                        Name = "Sob-Nedz.", WorkHours = "10.00-21.00"
                    }
                }
            };
            var            homePresentationService = Substitute.For <IHomePresentationService>();
            var            xmlManager = Substitute.For <IXmlManager>();
            HomeController controller = new HomeController(homePresentationService, xmlManager);

            // Act
            xmlManager.GetFullShopInformation().Returns(contactAndHoursViewModel);
            ViewResult result   = controller.Contact() as ViewResult;
            string     viewName = result.ViewName;
            var        model    = result.Model;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Contact", viewName);
            Assert.IsNotNull(model);
        }