Ejemplo n.º 1
0
        public async Task GetById_JournalFound_ReturnsJournal()
        {
            // Arrange
            await PrepareDatabase();

            var journal = Helpers.GetJournal();

            Context !.Journals?.Add(journal);
            await Context.SaveChangesAsync();

            var repo = GetJournalRepo();

            // Act
            var result = await repo.GetById(journal.Id);

            // Assert
            result.Should().NotBeNull();
            result !.Id.Should().Be(journal.Id);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds an <see cref="iCalObject"/>-based component to the
        /// appropriate collection.  Currently, the iCalendar component
        /// supports the following components:
        ///     <list type="bullet">
        ///         <item><see cref="Event"/></item>
        ///         <item><see cref="FreeBusy"/></item>
        ///         <item><see cref="Journal"/></item>
        ///         <item><see cref="DDay.iCal.Components.TimeZone"/></item>
        ///         <item><see cref="Todo"/></item>
        ///     </list>
        /// </summary>
        /// <param name="child"></param>
        public override void AddChild(iCalObject child)
        {
            base.AddChild(child);

            Type type = child.GetType();

            switch (type.Name)
            {
            case "Event": Events.Add(child); break;

            case "FreeBusy": FreeBusy.Add(child); break;

            case "Journal": Journals.Add(child); break;

            case "TimeZone": TimeZones.Add(child); break;

            case "Todo": Todos.Add(child); break;

            default: break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds an <see cref="iCalObject"/>-based component to the
        /// appropriate collection.  Currently, the iCalendar component
        /// supports the following components:
        ///     <list type="bullet">
        ///         <item><see cref="Event"/></item>
        ///         <item><see cref="FreeBusy"/></item>
        ///         <item><see cref="Journal"/></item>
        ///         <item><see cref="DDay.iCal.Components.TimeZone"/></item>
        ///         <item><see cref="Todo"/></item>
        ///     </list>
        /// </summary>
        /// <param name="child"></param>
        public override void AddChild(iCalObject child)
        {
            base.AddChild(child);
            child.Parent = this;

            Type type = child.GetType();

            switch (type.Name)
            {
            case "Event": Events.Add((Event)child); break;

            case "FreeBusy": FreeBusy.Add((FreeBusy)child); break;

            case "Journal": Journals.Add((Journal)child); break;

            case "TimeZone": TimeZones.Add((DDay.iCal.Components.TimeZone)child); break;

            case "Todo": Todos.Add((Todo)child); break;

            default: break;
            }
        }
 private void OnMessage(Journal newJournal)
 {
     Journals.Add(newJournal);
 }