public void IfNameNullOrEmpty_Throws() { var projectSystem = new NuGetMsBuildProjectSystem(@"C:\DummyPath\Dummy.csproj", MockGenerator.CreateMSBuildProjectFactory()); Assert.Throws<ArgumentNullException>(() => projectSystem.AddReference(null, Stream.Null)); Assert.Throws<ArgumentNullException>(() => projectSystem.AddReference(string.Empty, Stream.Null)); }
public void UseRelativeHintPath(string fullPath, string hintPath) { // arrange var mockProject = MockGenerator.CreateMockMSBuildProject(); string actualHint = ""; mockProject.Setup(p => p.AddReference(It.IsAny<string>(), It.IsAny<string>())) .Callback<string, string>((_, hint) => actualHint = hint) .Verifiable(); // act var projectSystem = new NuGetMsBuildProjectSystem(@"C:\DummyPath\Dummy.csproj", MockGenerator.CreateMSBuildProjectFactory(mockProject.Object)); projectSystem.AddReference(fullPath, Stream.Null); // assert Assert.Equal(hintPath, actualHint); mockProject.Verify(); }
public void AddingReference_CallSaveProject() { // arrange var mockProject = MockGenerator.CreateMockMSBuildProject_SaveMethodVerifiable(); // act var projectSystem = new NuGetMsBuildProjectSystem(@"C:\DummyPath\Dummy.csproj", MockGenerator.CreateMSBuildProjectFactory(mockProject.Object)); projectSystem.AddReference(@"C:\DummyPath\packages\Dummy.dll", Stream.Null); // assert mockProject.Verify(); }