public async Task FoundId_Widget() { var service = TestUtility.CreateService(m_category); var widget = InMemoryExampleApiRepository.SampleWidgets[0]; string eTag = ExampleApiService.CreateWidgetETag(widget); (await service.GetWidgetAsync(id: widget.Id)) .Should().BeSuccess(new GetWidgetResponseDto { Widget = widget, ETag = eTag }); }
public async Task Modified_Widget() { var service = TestUtility.CreateService(m_category); var widget = InMemoryExampleApiRepository.SampleWidgets[0]; string eTag = ExampleApiService.CreateWidgetETag(widget); (await service.GetWidgetAsync(new GetWidgetRequestDto { Id = widget.Id, IfNoneMatch = "\"xyzzy\"" }, CancellationToken.None)) .Should().BeSuccess(new GetWidgetResponseDto { Widget = widget, ETag = eTag }); }
public async Task BadIfNoneMatch() { var service = TestUtility.CreateService(m_category); var widget = InMemoryExampleApiRepository.SampleWidgets[0]; string eTag = ExampleApiService.CreateWidgetETag(widget); var result = await service.GetWidgetAsync(new GetWidgetRequestDto { Id = widget.Id, IfNoneMatch = "xyzzy" }, CancellationToken.None); if (m_category == "InMemory") { result.Should().BeSuccess(new GetWidgetResponseDto { Widget = widget, ETag = eTag }); } else { result.Should().BeFailure(HttpServiceErrors.CreateHeaderInvalidFormat("If-None-Match")); } }