Пример #1
0
        public async Task GetByIdAsync_WithNonExistentId_ShouldReturnNull()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.reviewService = new AdminReviewService(context);

            AdminReviewListingServiceModel actualData = await this.reviewService.GetByIdAsync(-1);

            Assert.True(actualData == null);
        }
Пример #2
0
        public async Task GetByIdAsync_WithExistentId_ShouldReturnCorrectResult()
        {
            var context = BookStoreDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.reviewService = new AdminReviewService(context);

            AdminReviewListingServiceModel expectedData = context.Reviews.First().To <AdminReviewListingServiceModel>();
            AdminReviewListingServiceModel actualData   = await this.reviewService.GetByIdAsync(expectedData.Id);

            Assert.True(expectedData.Id == actualData.Id, "Id is not returned properly.");
        }