public void IsRecompilationSupported_NoPrimaryChecksumAttribute_ReturnsFalse() { // Arrange var item = new TestRazorCompiledItem(typeof(string), "mvc.1.0.view", "/Views/Home/Index.cstml", new object[] { new RazorSourceChecksumAttribute("SHA1", TestRazorCompiledItem.GetChecksum("some import"), "/Views/Home/_ViewImports.cstml"), }); // Act var result = PublicChecksumValidator.IsRecompilationSupported(item); // Assert Assert.False(result); }
public void IsItemValid_NoPrimaryChecksumAttribute_ReturnsTrue() { // Arrange var item = new TestRazorCompiledItem(typeof(string), "mvc.1.0.view", "/Views/Home/Index.cstml", new object[] { new RazorSourceChecksumAttribute("SHA1", TestRazorCompiledItem.GetChecksum("some import"), "/Views/Home/_ViewImports.cstml"), new RazorSourceChecksumAttribute("SHA1", TestRazorCompiledItem.GetChecksum("some content"), "/Views/Home/About.cstml"), }); // Act var result = PublicChecksumValidator.IsItemValid(ProjectFileSystem, item); // Assert Assert.True(result); }
public void IsItemValid_PrimaryFileDoesNotExist_ReturnsTrue() { // Arrange var item = new TestRazorCompiledItem(typeof(string), "mvc.1.0.view", "/Views/Home/Index.cstml", new object[] { new RazorSourceChecksumAttribute("SHA1", TestRazorCompiledItem.GetChecksum("some import"), "/Views/Home/_ViewImports.cstml"), new RazorSourceChecksumAttribute("SHA1", TestRazorCompiledItem.GetChecksum("some content"), "/Views/Home/Index.cstml"), }); ProjectFileSystem.Add(new TestRazorProjectItem("/Views/Home/_ViewImports.cstml", "dkdkfkdf")); // This will be ignored // Act var result = PublicChecksumValidator.IsItemValid(ProjectFileSystem, item); // Assert Assert.True(result); }
public void IsItemValid_ImportFileExistsButDoesNotMatch_ReturnsFalse() { // Arrange var item = new TestRazorCompiledItem(typeof(string), "mvc.1.0.view", "/Views/Home/Index.cstml", new object[] { new RazorSourceChecksumAttribute("SHA1", TestRazorCompiledItem.GetChecksum("some import"), "/Views/Home/_ViewImports.cstml"), new RazorSourceChecksumAttribute("SHA1", TestRazorCompiledItem.GetChecksum("some content"), "/Views/Home/Index.cstml"), }); ProjectFileSystem.Add(new TestRazorProjectItem("/Views/Home/Index.cstml", "some content")); ProjectFileSystem.Add(new TestRazorProjectItem("/Views/Home/_ViewImports.cstml", "some other import")); // Act var result = PublicChecksumValidator.IsItemValid(ProjectFileSystem, item); // Assert Assert.False(result); }