public void Merge_PicksLastBaseTypeChunkFromChunkTree() { // Arrange var merger = new SetBaseTypeChunkMerger("dynamic"); var chunkTree = new ChunkTree(); var inheritedChunks = new Chunk[] { new SetBaseTypeChunk { TypeName = "MyBase2" }, new LiteralChunk(), new SetBaseTypeChunk { TypeName = "MyBase1" }, }; // Act merger.MergeInheritedChunks(chunkTree, inheritedChunks); // Assert var chunk = Assert.Single(chunkTree.Chunks); var setBaseTypeChunk = Assert.IsType <SetBaseTypeChunk>(chunk); Assert.Equal("MyBase1", setBaseTypeChunk.TypeName); }
public void Merge_IgnoresSetBaseTypeChunksIfChunkTreeContainsOne() { // Arrange var merger = new SetBaseTypeChunkMerger("dynamic"); var chunkTree = new ChunkTree(); var inheritedChunks = new[] { new SetBaseTypeChunk { TypeName = "MyBaseType2" } }; // Act merger.VisitChunk(new SetBaseTypeChunk { TypeName = "MyBaseType1" }); merger.MergeInheritedChunks(chunkTree, inheritedChunks); // Assert Assert.Empty(chunkTree.Children); }
public void Merge_SetsBaseTypeIfItHasNotBeenSetInChunkTree() { // Arrange var expected = "MyApp.Razor.MyBaseType"; var merger = new SetBaseTypeChunkMerger("dynamic"); var chunkTree = new ChunkTree(); var inheritedChunks = new[] { new SetBaseTypeChunk { TypeName = expected } }; // Act merger.MergeInheritedChunks(chunkTree, inheritedChunks); // Assert var chunk = Assert.Single(chunkTree.Children); var setBaseTypeChunk = Assert.IsType<SetBaseTypeChunk>(chunk); Assert.Equal(expected, setBaseTypeChunk.TypeName); }
public void Merge_PicksLastBaseTypeChunkFromChunkTree() { // Arrange var merger = new SetBaseTypeChunkMerger("dynamic"); var chunkTree = new ChunkTree(); var inheritedChunks = new Chunk[] { new SetBaseTypeChunk { TypeName = "MyBase2" }, new LiteralChunk(), new SetBaseTypeChunk { TypeName = "MyBase1" }, }; // Act merger.MergeInheritedChunks(chunkTree, inheritedChunks); // Assert var chunk = Assert.Single(chunkTree.Children); var setBaseTypeChunk = Assert.IsType<SetBaseTypeChunk>(chunk); Assert.Equal("MyBase1", setBaseTypeChunk.TypeName); }
public void Merge_IgnoresSetBaseTypeChunksIfChunkTreeContainsOne() { // Arrange var merger = new SetBaseTypeChunkMerger("dynamic"); var chunkTree = new ChunkTree(); var inheritedChunks = new[] { new SetBaseTypeChunk { TypeName = "MyBaseType2" } }; // Act merger.VisitChunk(new SetBaseTypeChunk { TypeName = "MyBaseType1" }); merger.MergeInheritedChunks(chunkTree, inheritedChunks); // Assert Assert.Empty(chunkTree.Chunks); }
public void Merge_SetsBaseTypeIfItHasNotBeenSetInChunkTree() { // Arrange var expected = "MyApp.Razor.MyBaseType"; var merger = new SetBaseTypeChunkMerger("dynamic"); var chunkTree = new ChunkTree(); var inheritedChunks = new[] { new SetBaseTypeChunk { TypeName = expected } }; // Act merger.MergeInheritedChunks(chunkTree, inheritedChunks); // Assert var chunk = Assert.Single(chunkTree.Chunks); var setBaseTypeChunk = Assert.IsType <SetBaseTypeChunk>(chunk); Assert.Equal(expected, setBaseTypeChunk.TypeName); }