< Summary

Class:Azure.Core.Tests.TestFramework.TestRandom
Assembly:Azure.Core.TestFramework
File(s):C:\Git\azure-sdk-for-net\sdk\core\Azure.Core.TestFramework\src\TestRandom.cs
Covered lines:10
Uncovered lines:1
Coverable lines:11
Total lines:39
Line coverage:90.9% (10 of 11)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
NewGuid()-80%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\core\Azure.Core.TestFramework\src\TestRandom.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core.TestFramework;
 6
 7namespace Azure.Core.Tests.TestFramework
 8{
 9    public class TestRandom : Random
 10    {
 11        private readonly RecordedTestMode _mode;
 12
 13        public TestRandom(RecordedTestMode mode, int seed) :
 836914            base(seed)
 15        {
 836916            _mode = mode;
 836917        }
 18
 19        public TestRandom(RecordedTestMode mode) :
 220            base()
 21        {
 222            _mode = mode;
 223        }
 24
 25        public Guid NewGuid()
 26        {
 5580427            if (_mode == RecordedTestMode.Live)
 28            {
 029                return Guid.NewGuid();
 30            }
 31            else
 32            {
 5580433                var bytes = new byte[16];
 5580434                NextBytes(bytes);
 5580435                return new Guid(bytes);
 36            }
 37        }
 38    }
 39}

Methods/Properties

.ctor(...)
.ctor(...)
NewGuid()