当前位置: 首页>>代码示例>>C#>>正文


C# Events.Add方法代码示例

本文整理汇总了C#中Events.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Events.Add方法的具体用法?C# Events.Add怎么用?C# Events.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Events的用法示例。


在下文中一共展示了Events.Add方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShouldDisplayAllEvents

        public void ShouldDisplayAllEvents()
        {
            Events newEvent = new Events();

            string expectedConsole;
            var consoleOut = new StringWriter();

            string date = "2015/12/25";
            string title = "Christmas Day!";
            string description = "Santa Claus is comming in our house....";

            newEvent.EventsList.ShouldBeEmpty();
            newEvent.Add(date, title, description);

            string date1 = "2015/10/25";
            string title1 = "Johana's Birtday!";
            string description1 = "Don't forget to call her...";
            newEvent.Add(date1, title1, description1);

            expectedConsole = " \nDate:" + Convert.ToDateTime(date1).ToString("yyyy/MM/dd") + " \nTitle:" + title1 + " \nDescription:" + description1 + "\n" +
                " \nDate:" + Convert.ToDateTime(date).ToString("yyyy/MM/dd") + " \nTitle:" + title + " \nDescription:" + description;

            Console.SetOut(consoleOut);
            IOConsole newObj = new IOConsole(newEvent);
            newObj.DisplayEventsToConsole();

            consoleOut.ToString().ShouldContain(expectedConsole);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:28,代码来源:TestsConsole.cs

示例2: ShouldExportTOHTMLFromStream

        public void ShouldExportTOHTMLFromStream()
        {
            string expectedFile = @"<!DOCTYPE html>
            <html>
            <head>
            <title>Events List</title>
            </head>
            <body><p><b>Date:</b> 2015.12.25</p>
            <p><b>Subject:</b> Christmas!</p><p><b>Title:</b> Christmas</p><p><b>Description:</b> Santa Claus</p><hr>
            </body>
            </html>";

            expectedFile = expectedFile.Replace("\r", "");
            Events newEvent = new Events();

            string date = "2015/12/25";
            string title = "Christams";
            string description = "Santa Claus";
            newEvent.Add(date, title,description);

            using (MemoryStream ms = new MemoryStream())
            {
                using (IOStream streamObj = new IOStream(ms))
                {
                    streamObj.ExportEventsInHTMLStream(newEvent);
                    var htmlContent = Encoding.UTF8.GetString(ms.ToArray());
                    htmlContent.ShouldContain(expectedFile);
                }
            }
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:30,代码来源:TestsStream.cs

示例3: ShouldNotAddEvent

 public void ShouldNotAddEvent()
 {
     string date = "2015/15/20";
     string subject = "My birthday";
     string description = "It will be a nice day...";
     Events newEvent = new Events();
     newEvent.Add(date, subject, description);
 }
开发者ID:sorinam,项目名称:Calendar,代码行数:8,代码来源:UnitTestEvents.cs

示例4: ShouldAddEventWithoutDescription

        public void ShouldAddEventWithoutDescription()
        {
            string date = "2015/11/20";
            string subject = "My birthday";
            Events newEvent = new Events();

            newEvent.Add(date, subject);
            List<Event> listofEvents = newEvent.EventsList;

            listofEvents[0].Date.ShouldEqual(Convert.ToDateTime(date));
            listofEvents[0].Subject.ShouldEqual(subject);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:12,代码来源:UnitTestEvents.cs

示例5: ApplyFilter

 public Events ApplyFilter(Events sourceList)
 {
     Events filteredList = new Events();
     Event compare = new Event(dateToCompare, "", "");
     foreach (Event ev in sourceList)
     {
         if (IsTrueCriteria(ev, compare, criteria))
         {
             filteredList.Add(ev);
         }
     }
     return filteredList;
 }
开发者ID:sorinam,项目名称:Calendar,代码行数:13,代码来源:DateFilter.cs

示例6: ApplyFilter

        public Events ApplyFilter(Events sourceList)
        {
            Events filteredList = new Events();

            foreach (Event ev in sourceList)
            {
                if (IsTrueCriteria(ev, criteria))
                {
                    filteredList.Add(ev);
                }
            }

            return filteredList;
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:14,代码来源:TagFilter.cs

示例7: ShouldAddMultiLineEvent

        public void ShouldAddMultiLineEvent()
        {
            string date = "2015/11/20";
            string subject = "My birthday";
            string description = "It will be a nice day...\n Nice party....\n....";
            Events newEvent = new Events();

            newEvent.Add(date, subject, description);
            List<Event> listofEvents = newEvent.EventsList;

            listofEvents[0].Date.ShouldEqual(Convert.ToDateTime(date));
            listofEvents[0].Subject.ShouldEqual(subject);
            listofEvents[0].Description.ShouldEqual(description);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:14,代码来源:UnitTestEvents.cs

示例8: ShouldSortEvents

        public void ShouldSortEvents()
        {
            Events newEvent = new Events();

            string date = "2015/11/20";
            string subject = "My birthday";
            string description = "It will be a nice day...\n Nice party....\n....";
            newEvent.Add(date, subject, description);

            date = "2015/10/20";
            subject = "Joana's birthday";
            newEvent.Add(date, subject);

            List<Event> expectedList = new List<Event>{
                new Event ("2015/10/20","Joana's birthday"),
                new Event("2015/11/20", "My birthday", "It will be a nice day...\n Nice party....\n....")};

            List<Event> listofEvents = newEvent.EventsList;
            listofEvents.Sort();

            expectedList.ShouldEqual(listofEvents);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:22,代码来源:UnitTestEvents.cs

示例9: Class

 public Class(int id, Events events)
 {
     _id = id;
     _events = events;
     _events.Add([email protected]".ctor {_id}");
 }
开发者ID:agabani,项目名称:DesignPatterns,代码行数:6,代码来源:Class.cs

示例10: ShouldDisplayEventsFromCertainDate

        public void ShouldDisplayEventsFromCertainDate()
        {
            Events newEvents = new Events();
            IOConsole toDisplay = new IOConsole();

            string expectedConsole;
            var consoleOut = new StringWriter();

            string date = "2019/12/25";
            string title = "Christmas Day!";
            string description = "Santa Claus is comming in our house....";

            string date1 = "2015/10/25";
            string title1 = "Johana's Birtday!";
            string description1 = "Don't forget to call her...";

            SetExpectedResultToConsole(date1, title1,out expectedConsole, out consoleOut, description1);

            newEvents.EventsList.ShouldBeEmpty();
            newEvents.Add(date, title, description);
            newEvents.Add(date1, title1, description1);

            DateFilter eventsToDisplay = new DateFilter("=", "2015/10/25");
            Events filteredList = eventsToDisplay.ApplyFilter(newEvents);

            IOConsole newObj = new IOConsole(filteredList);
            newObj.DisplayEventsToConsole();
            consoleOut.ToString().ShouldContain(expectedConsole);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:29,代码来源:TestsConsole.cs

示例11: ShouldDisplayOneEventWithoutDescription

        public void ShouldDisplayOneEventWithoutDescription()
        {
            Events newEvent = new Events();
            string expectedConsole;
            StringWriter consoleOut;

            string date = "2015/12/25";
            string title = "Christmas Day!";
            SetExpectedResultToConsole(date, title, out expectedConsole, out consoleOut);

            newEvent.EventsList.ShouldBeEmpty();
            newEvent.Add(date, title);

            IOConsole newObj = new IOConsole(newEvent);
            newObj.DisplayEventsToConsole();

            consoleOut.ToString().ShouldContain(expectedConsole);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:18,代码来源:TestsConsole.cs

示例12: ShouldDisplayOneEvent

        public void ShouldDisplayOneEvent()
        {
            Events newEvent = new Events();
            string expectedConsole;
            StringWriter consoleOut;

            string date = "2015/12/25";
            string title = "Santa Claus";
            string description = "Santa Claus is comming in our house....";
            SetExpectedResultToConsole(date, title,out expectedConsole, out consoleOut,description);

            newEvent.EventsList.ShouldBeEmpty();
            newEvent.Add(date, title,description);

            IOConsole newObj = new IOConsole(newEvent);
            newObj.DisplayEventsToConsole();

            consoleOut.ToString().ShouldContain(expectedConsole);
        }
开发者ID:sorinam,项目名称:Calendar,代码行数:19,代码来源:TestsConsole.cs

示例13: SearchByParam

        /// <summary>
        /// SearchByParam
        /// </summary>
        ///<param name="pEvent">Event</param>
        ///<param name="pEndDate">pEndDate</param>
        /// <returns>LogsList</returns>
        /// <Date>2010-02-26T10:05:27</Date>
        /// <Author>moviedo</Author>
        public override  Events SearchByParam(Event pEvent,DateTime pEndDate)
        {
            Events wEventList = new Events();
            Event wEvent;
            using (SqlConnection wCnn = new SqlConnection(GetCnnString()))
            using (SqlCommand wCmd = new SqlCommand())
            {
                try
                {
                    wCnn.Open();
                    wCmd.Connection = wCnn;
                    wCmd.CommandType = CommandType.StoredProcedure;
                    wCmd.CommandText = "fwk_Logs_s";
                    SqlParameter wParam = null;


                    if (!string.IsNullOrEmpty(pEvent.Source))
                    {
                        wParam = wCmd.Parameters.Add("Source", SqlDbType.NVarChar);
                        wParam.Value = string.Concat("%", pEvent.Source, "%");
                    }
             

               
                    if (pEvent.LogType != EventType.None)
                    {
                        wParam = wCmd.Parameters.Add("LogType", SqlDbType.NVarChar);
                        wParam.Value = pEvent.LogType;
                    }
                    if (pEvent.LogDate != Fwk.HelperFunctions.DateFunctions.NullDateTime)
                    {
                        wParam = wCmd.Parameters.Add("LogDateDesde", SqlDbType.DateTime);
                        wParam.Value = pEvent.LogDate;

                    }

                    if (pEndDate != Fwk.HelperFunctions.DateFunctions.NullDateTime)
                    {
                        wParam = wCmd.Parameters.Add("LogDateHasta", SqlDbType.DateTime);
                        wParam.Value = pEndDate;
                    }

                    if (!string.IsNullOrEmpty(pEvent.Machine))
                    {
                        wParam = wCmd.Parameters.Add("Machine", SqlDbType.NVarChar);
                        wParam.Value = string.Concat("%", pEvent.Machine, "%");
                    }

                    if (!string.IsNullOrEmpty(pEvent.User))
                    {
                        wParam = wCmd.Parameters.Add("UserLoginName", SqlDbType.NVarChar);
                        wParam.Value = string.Concat("%", pEvent.User, "%");
                    }

                    if (!string.IsNullOrEmpty(pEvent.AppId))
                    {
                        wParam = wCmd.Parameters.Add("AppId", SqlDbType.NVarChar);
                        wParam.Value = string.Concat("%", pEvent.AppId, "%");
                    }

                    

                    using (IDataReader reader = wCmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {

                            wEvent = new Event();
                            wEvent.Id = new Guid(reader["Id"].ToString());
                        
                            wEvent.Message.Text = TypeFunctions.ConvertBytesToTextString((Byte[])(reader["Message"]));
                            wEvent.Source = reader["Source"].ToString();
                            wEvent.LogType = (EventType)Enum.Parse(typeof(EventType), reader["LogType"].ToString());
                            wEvent.Machine = reader["Machine"].ToString();
                            wEvent.LogDate = Convert.ToDateTime(reader["LogDate"]);
                            wEvent.User = reader["UserLoginName"].ToString();
                            wEvent.AppId = reader["AppId"].ToString();
                            wEventList.Add(wEvent);
                        }
                    }

                    return wEventList;

                }
                catch (Exception ex)
                {
                    TechnicalException te = new TechnicalException("Error de Fwk.Logging", ex);
                    te.ErrorId = "9004";
                    Fwk.Exceptions.ExceptionHelper.SetTechnicalException<DatabaseTarget>(te);
                    throw te;
                }
            }
//.........这里部分代码省略.........
开发者ID:Pelsoft,项目名称:fwk_10.3,代码行数:101,代码来源:DatabaseTarget.cs


注:本文中的Events.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。