Exemple #1
0
        public async Task FindTheater_restores_read_model_entity_correctly(
            Theater theater)
        {
            // Arrange
            theater.ETag = default;
            IDocumentClient client = DocumentClient;
            var             sut    = new CosmosDbTheaterRepository(client, Collection);
            await sut.CreateTheater(theater);

            // Act
            Theater actual = await sut.FindTheater(theater.Id);

            // Assert
            IQueryable <TheaterDocument> query =
                from d in client.CreateDocumentQuery <TheaterDocument>()
                where
                d.Discriminator == nameof(TheaterDocument) &&
                d.Id == theater.Id
                select d;

            TheaterDocument document = await query.SingleOrDefault();

            actual.Should().BeEquivalentTo(new
            {
                document.Id,
                document.ETag,
                document.Name,
                document.SeatRowCount,
                document.SeatColumnCount,
                document.CreatedAt,
            });
        }
Exemple #2
0
        public async Task given_document_not_found_then_FindTheater_returns_null(
            Guid theaterId)
        {
            var     sut    = new CosmosDbTheaterRepository(DocumentClient, Collection);
            Theater actual = await sut.FindTheater(theaterId);

            actual.Should().BeNull();
        }