public void StorageIsCorrect(
            [Frozen] IAtomEventStorage expected,
            AtomEventStream <DataContractTestEventX> sut)
        {
            IAtomEventStorage actual = sut.Storage;

            Assert.Equal(expected, actual);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FifoEvents{T}" />
        /// class.
        /// </summary>
        /// <param name="id">The ID of the event stream.</param>
        /// <param name="storage">
        /// The underlying storage mechanism from which to read.
        /// </param>
        /// <param name="serializer">
        /// The serializer used to serialize and deserialize items to a format
        /// compatible with Atom. The object supplied via this constructor
        /// parameter is subsequently available via the
        /// <see cref="Serializer" /> property.
        /// </param>
        /// <remarks>
        /// <para>
        /// The <paramref name="id" /> is the ID of a single event stream. Each
        /// event stream has its own ID. If you need more than a single event
        /// stream (e.g. if you are implementing the Aggregate Root pattern),
        /// each event stream should have a separate ID.
        /// </para>
        /// <para>
        /// The <paramref name="storage" /> value can be any implementation of
        /// <see cref="IAtomEventStorage" />. Built-in implementatoins include
        /// <see cref="AtomEventsInMemory" /> and
        /// <see cref="AtomEventsInFiles" />.
        /// </para>
        /// </remarks>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="storage" /> or <paramref name="serializer" /> is
        /// <see langword="null" />
        /// </exception>
        /// <seealso cref="FifoEvents{T}" />
        /// <seealso cref="IContentSerializer" />
        /// <seealso cref="AtomEventsInMemory" />
        /// <seealso cref="AtomEventsInFiles" />
        /// <seealso cref="IAtomEventStorage" />
        public FifoEvents(
            UuidIri id,
            IAtomEventStorage storage,
            IContentSerializer serializer)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }
            if (serializer == null)
            {
                throw new ArgumentNullException("serializer");
            }

            this.id         = id;
            this.storage    = storage;
            this.serializer = serializer;
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AtomEventStream{T}" />
        /// class.
        /// </summary>
        /// <param name="id">The ID of the event stream.</param>
        /// <param name="storage">
        /// The underlying storage mechanism to use.
        /// </param>
        /// <param name="pageSize">
        /// The maxkum page size; that is: the maximum number of instances of
        /// T stored in a single Atom feed page.
        /// </param>
        /// <param name="contentSerializer">
        /// The serializer used to serialize and deserialize items to a format
        /// compatible with Atom. The object supplied via this constructor
        /// parameter is subsequently available via the
        /// <see cref="ContentSerializer" /> property.
        /// </param>
        /// <remarks>
        /// <para>
        /// The <paramref name="id" /> is the ID of a single event stream. Each
        /// event stream has its own ID. If you need more than a single event
        /// stream (e.g. if you are implementing the Aggregate Root pattern),
        /// each event stream should have a separate ID.
        /// </para>
        /// <para>
        /// The <paramref name="storage" /> value can be any implementation of
        /// <see cref="IAtomEventStorage" />. Built-in implementatoins include
        /// <see cref="AtomEventsInMemory" /> and
        /// <see cref="AtomEventsInFiles" />.
        /// </para>
        /// </remarks>
        /// <seealso cref="AtomEventStream{T}" />
        /// <seealso cref="ContentSerializer" />
        /// <seealso cref="AtomEventsInMemory" />
        /// <seealso cref="AtomEventsInFiles" />
        /// <seealso cref="IAtomEventStorage" />
        public AtomEventStream(
            UuidIri id,
            IAtomEventStorage storage,
            int pageSize,
            IContentSerializer contentSerializer)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }
            if (contentSerializer == null)
            {
                throw new ArgumentNullException("contentSerializer");
            }

            this.id         = id;
            this.storage    = storage;
            this.pageSize   = pageSize;
            this.serializer = contentSerializer;
        }