public void UpdateCoverageDataForResourceEmtpyDataTest() { var element = new Resource { Date = new DateTime(2000, 1, 1) }; var source = new SourceCoverage(); this.service.Expect( mp => mp.GetResourcesData(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Equal("resource"))) .Return(new List<Resource> { element }) .Repeat.Once(); this.service.Expect( mp => mp.GetCoverageInResource(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Equal("resource"))) .Return(source); var data = new ExtensionDataModel(this.service, this.vshelper, null); Assert.AreEqual(source, data.UpdateCoverageDataForResource("resource", false)); }
public void UpdateCoverageDataForResourceWithNewDateDataTest() { var element = new Resource(); var newResource = new Resource { Date = DateTime.Now }; var source1 = new SourceCoverage(); source1.SetLineCoverageData("1=0;2=3;2=3"); source1.SetBranchCoverageData("1=0;2=3;2=3", "1=0;2=3;2=3"); var source2 = new SourceCoverage(); this.service.Expect( mp => mp.GetResourcesData(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Equal("resource"))) .Return(new List<Resource> { element }) .Repeat.Once(); this.service.Expect( mp => mp.GetResourcesData(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Equal("resource"))) .Return(new List<Resource> { newResource }); this.service.Expect( mp => mp.GetCoverageInResource(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Equal("resource"))) .Return(source1) .Repeat.Once(); this.service.Expect( mp => mp.GetCoverageInResource(Arg<ConnectionConfiguration>.Is.Anything, Arg<string>.Is.Equal("resource"))) .Return(source2); var data = new ExtensionDataModel(this.service, this.vshelper, null); data.EnableCoverageInEditor = true; Assert.AreEqual(source1, data.UpdateCoverageDataForResource("resource", false)); Assert.AreEqual(source2, data.UpdateCoverageDataForResource("resource", false)); }