Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64185d2

Browse files
committed
add test
1 parentc4fb65d commit64185d2

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

‎vsintegration/src/unittests/Tests.ProjectSystem.References.fs‎

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ open UnitTests.TestLib.ProjectSystem
1616
openMicrosoft.VisualStudio.FSharp.ProjectSystem
1717
openMicrosoft.VisualStudio.Shell.Interop
1818
openMicrosoft.Win32
19+
openSystem.Xml.Linq
1920

2021
[<TestFixture>]
2122
typeReferences()=
@@ -618,4 +619,60 @@ type References() =
618619
// look for the new property inside of the project file
619620
letcontents= File.ReadAllText(newProjFileName)
620621
AssertContains contents newPropVal
621-
)
622+
)
623+
624+
625+
[<Test>]
626+
memberpublicthis.``AddReference.COM``()=
627+
DoWithTempFile"Test.fsproj"(fun projFile->
628+
File.AppendAllText(projFile, TheTests.SimpleFsprojText([],[],""))
629+
use project= TheTests.CreateProject(projFile)
630+
631+
letguid= Guid("50a7e9b0-70ef-11d1-b75a-00a0c90564fe")
632+
633+
letselectorData= VSCOMPONENTSELECTORDATA(
634+
``type``= VSCOMPONENTTYPE.VSCOMPONENTTYPE_Com2,
635+
guidTypeLibrary= guid,
636+
wTypeLibraryMinorVersion=0us,
637+
wTypeLibraryMajorVersion=1us,
638+
bstrTitle="Microsoft Shell Controls And Automation")
639+
letrefContainer= GetReferenceContainerNode(project)
640+
641+
letcomReference= refContainer.AddReferenceFromSelectorData(selectorData)
642+
643+
// check reference node properties
644+
Assert.IsNotNull comReference
645+
Assert.IsInstanceOf(typeof<ComReferenceNode>, comReference)
646+
letcomRef= comReference:?> ComReferenceNode
647+
Assert.AreEqual(1, comRef.MajorVersionNumber)
648+
Assert.AreEqual(0, comRef.MinorVersionNumber)
649+
Assert.AreEqual(guid, comRef.TypeGuid)
650+
Assert.AreEqual("Microsoft Shell Controls And Automation", comRef.Caption)
651+
letsysDirectory= Environment.GetFolderPath(Environment.SpecialFolder.SystemX86)
652+
StringAssert.AreEqualIgnoringCase(Path.Combine(sysDirectory,"shell32.dll"), comRef.InstalledFilePath)
653+
654+
// check node exists under references
655+
letl=new List<ComReferenceNode>()
656+
project.FindNodesOfType(l)
657+
658+
Assert.AreEqual(1, l.Count)
659+
letreferenceNode= l.[0]
660+
Assert.AreSame(comRef, referenceNode)
661+
662+
// check saved msbuild item
663+
SaveProject(project)
664+
letfsproj= XDocument.Load(project.FileName)
665+
printfn"%O" fsproj
666+
letxn s= fsproj.Root.GetDefaultNamespace().GetName(s)
667+
letcomReferencesXml= fsproj.Descendants(xn"COMReference")|> Seq.toList
668+
669+
Assert.AreEqual(1, comReferencesXml|> List.length)
670+
671+
letcomRefXml= comReferencesXml|> List.head
672+
673+
Assert.AreEqual("Microsoft Shell Controls And Automation", comRefXml.Attribute(XName.Get("Include")).Value)
674+
Assert.AreEqual(guid, Guid(comRefXml.Element(xn"Guid").Value))
675+
Assert.AreEqual("1", comRefXml.Element(xn"VersionMajor").Value)
676+
Assert.AreEqual("0", comRefXml.Element(xn"VersionMinor").Value)
677+
Assert.AreEqual("0", comRefXml.Element(xn"Lcid").Value)
678+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp