Esempio n. 1
0
        public async Task Handle_SuccessfulAffinityStatus_Throw(AffinityStatus status)
        {
            var policy  = new Return503ErrorAffinityFailurePolicy();
            var context = new DefaultHttpContext();

            await Assert.ThrowsAsync <InvalidOperationException>(() => policy.Handle(context, cluster: null, affinityStatus: status));
        }
Esempio n. 2
0
        public async Task Handle_FaultyAffinityStatus_RespondWith503(AffinityStatus status)
        {
            var policy  = new Return503ErrorAffinityFailurePolicy();
            var context = new DefaultHttpContext();

            Assert.Equal(SessionAffinityConstants.FailurePolicies.Return503Error, policy.Name);

            Assert.False(await policy.Handle(context, cluster: null, affinityStatus: status));
            Assert.Equal(503, context.Response.StatusCode);
        }