Exemplo n.º 1
0
        public async void TestGetByIdAsync()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "SubmissionDatabase")
                          .Options;

            var dbContext = new ApplicationDbContext(options);
            var repo      = new SubmissionRepository(dbContext);
            var json      = "{id: 123}";
            // Act
            var newSubmission =
                await repo.CreateAsync(new Submission { SavedDate = DateTime.Now, SubmissionJson = json });

            var createdId = newSubmission.Id;

            var searchResult = await repo.GetByIdAsync(createdId);

            // Assert
            Assert.True(createdId > 0 && searchResult.SubmissionJson == json);
        }