Ejemplo n.º 1
0
 public void lookup_system_guid()
 {
     var repository = new MsdnCodeDocMemberRepository();
     var model = repository.GetMemberModel("System.Guid");
     Assert.NotNull(model);
     Assert.True(model.HasSummaryContents);
     Assert.True(model.SummaryContents.First().Node.OuterXml.Contains("GUID"));
 }
Ejemplo n.º 2
0
        public void cache_performance_test()
        {
            var repository = new MsdnCodeDocMemberRepository();
            var requestNames = new[] { "System.Guid", "System.Object", "System.Array"};

            var firstRequestStopwatch = new Stopwatch();
            firstRequestStopwatch.Start();
            var firstRequests = Array.ConvertAll(requestNames, x => repository.GetMemberModel(x));
            firstRequests.Should().NotContainNulls();
            firstRequestStopwatch.Stop();

            var secondRequestStopwatch = new Stopwatch();
            secondRequestStopwatch.Start();
            // the request is a different code reference but for the same member
            var secondRequests = Array.ConvertAll(requestNames, x => repository.GetMemberModel("T:" + x));
            secondRequests.Should().NotContainNulls();
            secondRequestStopwatch.Stop();

            // the second set of requests should be (a lot) less than 3/4 of the first request
            var secondRequestTargetTime = new TimeSpan(firstRequestStopwatch.Elapsed.Ticks * 3 / 4);
            secondRequestStopwatch.Elapsed.Should().BeLessThan(secondRequestTargetTime);
        }
Ejemplo n.º 3
0
 public MsdnSimpleUsageFacts()
 {
     SharedRepository = new MsdnCodeDocMemberRepository();
 }