Exemple #1
0
        protected CallerContext SetTestContext(
            int subseq = -1,
            [System.Runtime.CompilerServices.CallerMemberName] string caller = "")
        {
            var m = this.GetType().GetMember(caller);

            if (m.Length != 1)
            {
                throw new InvalidOperationException("Unable to resolve single member from caller name");
            }

            LastContext = new CallerContext
            {
                Test        = this,
                Name        = caller,
                Member      = m[0],
                TestOrder   = TestOrderer.GetTestOrder(m[0]),
                TestGroup   = TestOrderer.GetTestGroup(m[0]),
                Subsequence = subseq,
                State       = State,
            };

            if (Clients?.Acme != null)
            {
                Clients.Acme.BeforeAcmeSign = BeforeAcmeSign;
                Clients.Acme.BeforeHttpSend = BeforeAcmeSend;
                Clients.Acme.AfterHttpSend  = AfterAcmeSend;
            }

            return(LastContext);
        }
Exemple #2
0
        private string ComputePrefix(int subseq = -1)
        {
            var to = TestOrderer.GetTestOrder(this);
            var nm = this.GetType().Name;

            var pfx = $"{to:D3}-{nm}";

            if (subseq >= 0)
            {
                pfx += $"-{subseq}";
            }
            return(pfx);
        }