Exemplo n.º 1
0
        public void GetLocations_NoStores_EmptyList()
        {
            var testSubject = new IssueLocationStoreAggregator(Enumerable.Empty <IIssueLocationStore>());
            var result      = testSubject.GetLocations("test.cpp");

            result.Should().BeEmpty();
        }
Exemplo n.º 2
0
        public void GetLocations_NullPath_ArgumentNullException()
        {
            var testSubject = new IssueLocationStoreAggregator(Enumerable.Empty <IIssueLocationStore>());

            Action act = () => testSubject.GetLocations(null);

            act.Should().Throw <ArgumentNullException>().And.ParamName.Should().Be("filePath");
        }
Exemplo n.º 3
0
        public void GetLocations_NoMatchingLocations_EmptyList()
        {
            const string filePath = "test.cpp";

            var stores = new List <Mock <IIssueLocationStore> >
            {
                new Mock <IIssueLocationStore>(),
                new Mock <IIssueLocationStore>(),
                new Mock <IIssueLocationStore>()
            };

            foreach (var store in stores)
            {
                store
                .Setup(x => x.GetLocations(filePath))
                .Returns(Enumerable.Empty <IAnalysisIssueLocationVisualization>());
            }

            var testSubject = new IssueLocationStoreAggregator(Enumerable.Empty <IIssueLocationStore>());
            var result      = testSubject.GetLocations(filePath);

            result.Should().BeEmpty();
        }
Exemplo n.º 4
0
        public void GetLocations_HasMatchingLocations_LocationsReturned()
        {
            const string filePath = "test.cpp";

            var store1 = new Mock <IIssueLocationStore>();

            store1.Setup(x => x.GetLocations(filePath)).Returns(Enumerable.Empty <IAnalysisIssueLocationVisualization>());

            var location1 = Mock.Of <IAnalysisIssueLocationVisualization>();
            var store2    = new Mock <IIssueLocationStore>();

            store2.Setup(x => x.GetLocations(filePath)).Returns(new [] { location1 });

            var location2 = Mock.Of <IAnalysisIssueLocationVisualization>();
            var location3 = Mock.Of <IAnalysisIssueLocationVisualization>();
            var store3    = new Mock <IIssueLocationStore>();

            store3.Setup(x => x.GetLocations(filePath)).Returns(new[] { location2, location3 });

            var testSubject = new IssueLocationStoreAggregator(new[] { store1.Object, store2.Object, store3.Object });
            var result      = testSubject.GetLocations(filePath);

            result.Should().BeEquivalentTo(location1, location2, location3);
        }