public static void AssertCodeBehindFileWasNotGenerated(this MockSolutionTestBase mockSolutionTest) { Assert.True( mockSolutionTest._MockSolution.AllMockFiles().All(x => !x.FileName.Extension.Equals("mixin.cs")), "Found a mixin.cs code behind file."); mockSolutionTest._MockCodeBehindFileHelper.AssertWasNotCalled( x => x.GetOrAddCodeBehindFile(Arg <FilePath> .Is.Anything)); mockSolutionTest._MockFileWrapper.AssertWasNotCalled( x => x.WriteAllText(Arg <FilePath> .Is.Anything, Arg <string> .Is.Anything)); }
public static void UpdateMockSourceFileSource (this MockSolutionTestBase mockSolutionTest, Func <MockSolution, MockSourceFile> mockSourceFileSelector, Func <MockSourceFile, string> updatedSourceFunc) { var sourceFile = mockSourceFileSelector(mockSolutionTest._MockSolution); Assert.NotNull(sourceFile, "mockSourceFileSelector returned null"); UpdateMockSourceFileSource( mockSolutionTest, mockSourceFileSelector(mockSolutionTest._MockSolution), updatedSourceFunc(sourceFile)); }
public static void AddMockSourceFile( this MockSolutionTestBase mockSolutionTest, Func <MockSolution, MockProject> projectSelector, string initialSource, string fileName = MockSourceFile.DefaultMockFileName) { AddMockSourceFile( mockSolutionTest, projectSelector, new MockSourceFile(fileName) { Source = initialSource }); }
public static void AssertCodeBehindFileWasGenerated(this MockSolutionTestBase mockSolutionTest, FilePath targetFile) { var codeBehindFile = new FilePath(targetFile.FullPath.ToLower().Replace(".cs", ".mixin.cs")); Assert.True( mockSolutionTest._MockSolution.AllMockFiles().Any( x => x.FileName.Equals(codeBehindFile)), "Failed to find code behind file [" + codeBehindFile + "]"); mockSolutionTest._MockCodeBehindFileHelper.AssertWasCalled( x => x.GetOrAddCodeBehindFile(Arg <FilePath> .Is.Equal(targetFile))); mockSolutionTest._MockFileWrapper.AssertWasCalled( x => x.WriteAllText(Arg <FilePath> .Is.Equal(codeBehindFile), Arg <string> .Is.Anything)); }
public static void AddMockSourceFile( this MockSolutionTestBase mockSolutionTest, Func <MockSolution, MockProject> projectSelector, MockSourceFile mockSourceFile) { var project = projectSelector(mockSolutionTest._MockSolution); project.MockSourceFiles.Add(mockSourceFile); //FireOnItemCreated mockSolutionTest.EventProxy.FireOnProjectItemAdded(mockSolutionTest, new ProjectItemAddedEventArgs { ClassFullPath = mockSourceFile.FileName, ProjectFullPath = project.FileName }); }
public static void UpdateMockSourceFileSource (this MockSolutionTestBase mockSolutionTest, MockSourceFile mockSourceFile, string updatedSource) { mockSourceFile.Source = updatedSource; var project = mockSolutionTest._MockSolution.Projects.FirstOrDefault( p => p.ContainsFile(mockSourceFile)); Assert.IsNotNull(project, "Could not find Project that has Source File [{0}", mockSourceFile.FileName); mockSolutionTest.EventProxy.FireOnProjectItemSaved(mockSolutionTest, new ProjectItemSavedEventArgs { ClassFullPath = mockSourceFile.FileName, ProjectFullPath = project.FileName }); }
public static void AssertCodeBehindFileWasGenerated(this MockSolutionTestBase mockSolutionTest, MockSourceFile targetFile) { mockSolutionTest.AssertCodeBehindFileWasGenerated(targetFile.FileName); }
public static void FireSolutionOpen(this MockSolutionTestBase mockSolutionTest) { mockSolutionTest.EventProxy.FireOnSolutionOpening(mockSolutionTest, new EventArgs()); }