Esempio n. 1
0
        public void TestExecuteActionAndGetResponse()
        {
            CatalogApp app = new CatalogApp();

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("Name", "Python");
            string action = "NEW_WORKSHOP";

            HandlerResponse response = app.ExecuteActionAndGetResponse(action, parameters);

            string result =
                "<workshops>" +
                "<workshop id='efcv4d' name='C++' status='Open' duration='22 Jan. 2019 ~ 15 Feb. 2019'></workshop>" +
                "<workshop id='74d5jh' name='C#' status='Closed' duration='2 May. 2018 ~ 19 May. 2018'></workshop>" +
                "<workshop id='r982jk' name='DDD' status='Open' duration='15 Dec. 2019 ~ 15 Mar. 2020'></workshop>" +
                "<workshop id='57adf0' name='Python' status='Open' duration='Unknown'></workshop>" +
                "</workshops>";

            Assert.AreEqual(result, response.GetXmlString());
        }
        public void executeActionAndGetResponseTest_ALL_WORKSHOPS()
        {
            List <Workshop> workshops = new List <Workshop> {
                new Workshop("HELLO", "OPEN", "2018/08")
            };
            var repository = new WorkshopRepository()
            {
                _workshops = workshops
            };
            var target = new CatalogApp();

            target.workshopManager = new WorkshopManager()
            {
                Repository = repository
            };
            var expectedString = "<workshop name='HELLO' status='OPEN' duration='2018/08'/>";

            var actual = target.executeActionAndGetResponse(CatalogApp.ALL_WORKSHOPS, null);

            Assert.AreEqual(actual.Builder.ToString(), expectedString);
            Assert.AreEqual(actual.ALlWorkshopsStylesheet, CatalogApp.ALL_WORKSHOPS_STYLESHEET);
        }
Esempio n. 3
0
 public NewWorkshopHandler(CatalogApp catalogApp) : base(catalogApp)
 {
 }
Esempio n. 4
0
 public AllWorkshopsHandler(CatalogApp catalogApp) : base(catalogApp)
 {
 }
Esempio n. 5
0
 protected Handler(CatalogApp catalogApp)
 {
     this._catalogApp = catalogApp;
 }