Beispiel #1
0
                public async Task TrackingConsentFeatureReturnsTrue_ReturnsTrue()
                {
                    var feature = TrackingFeature();

                    feature.CanTrack = true;

                    var service = new TrackingConsentService(HttpContextAccessor(feature));

                    Assert.True(await service.CanTrack());
                }
Beispiel #2
0
                public async Task HttpContextIsNull_Throws()
                {
                    var accessor = HttpContextAccessor();

                    accessor.HttpContext = null;

                    var service = new TrackingConsentService(accessor);

                    var exception = await Assert.ThrowsAsync <InvalidOperationException>(async() =>
                    {
                        await service.GrantConsent();
                    });

                    Assert.Equal("Operation requires an HttpContext from the IHttpContextAccessor.",
                                 exception.Message);
                }