public async Task create_clip_creates_a_clip() { // Arrange const int clipStartTime = 0; const int clipEndTime = 5; const string clipTranscription = ""; var clipToCreate = new Clip { StartTime = clipStartTime, EndTime = clipEndTime, Transcription = clipTranscription }; var options = new DbContextOptionsBuilder <BoucleDataContext>() .UseInMemoryDatabase(databaseName: "create_clip_creates_a_clip").Options; // Act await using (var context = new BoucleDataContext(options)) { var clipController = new ClipsController(context); var createdClipActionResult = await clipController.Create(clipToCreate); // Assert createdClipActionResult.Should().BeOfType <CreatedAtActionResult>(); createdClipActionResult.RouteValues.Should().Contain("Id", clipToCreate.Id); var clip = createdClipActionResult.Value.As <Clip>(); clip.Id.Should().BePositive(); clip.StartTime.Should().Be(clipStartTime); clip.EndTime.Should().Be(clipEndTime); clip.Transcription.Should().Be(clipTranscription); } // Act await using (var context = new BoucleDataContext(options)) { var allClips = await context.Clips.ToListAsync(); // Assert allClips.Should().HaveCount(1); var newlyCreatedClip = allClips.First(); newlyCreatedClip.Id.Should().Be(clipToCreate.Id); newlyCreatedClip.StartTime.Should().Be(clipStartTime); newlyCreatedClip.EndTime.Should().Be(clipEndTime); newlyCreatedClip.Transcription.Should().Be(clipTranscription); } }