public void TestMethod3() { Pattern[] patterns = { new Pattern() { Id = 1, Name = "Adapter", Description = "Adattatore" } , new Pattern() { Id = 2, Name = "Composite", Description = "Composto liste" } , new Pattern() { Id = 3, Name = "Singleton", Description = "Solo soletto" } }; IRenderAdapter adapter = new RenderAdapter(); PatternRenderer renderer = new PatternRenderer(adapter); string result = renderer.ListPatterns(patterns); Console.WriteLine(result); Assert.AreEqual(5, result.Count(c => c == '\n')); }
public void RenderTwoRowsGivenTwoPatternsInList() { var patternOne = new Pattern { Id = 1, Name = "A Pattern", Description = "Test object for testing." }; var patternTwo = new Pattern { Id = 2, Name = "Another Pattern", Description = "A friend to pattern one." }; var patterns = new List <Pattern>() { patternOne, patternTwo }; var renderer = new PatternRenderer(new DataPatternRenderer()); var result = renderer.ListPatterns(patterns); Approvals.Verify(result); }
public void ShouldRenderTwoPatterns() { var myRenderer = new PatternRenderer(); var myList = new List <Pattern> { new Pattern { Id = 1, Name = "Pattern One", Description = "Pattern One Description" }, new Pattern { Id = 2, Name = "Pattern Two", Description = "Pattern Two Description" } }; var result = myRenderer.ListPatterns(myList); Console.Write(result); const int headerLines = 2; var expectedNumberOfLines = myList.Count + headerLines; var numberOfLines = result.Count(c => c == '\n'); Assert.AreEqual(expectedNumberOfLines, numberOfLines); }
public void RenderTwoPatterns() { var patternCollectionAdapter = new PatternCollectionDbAdapter(); var myRenderer = new PatternRenderer(patternCollectionAdapter); var writer = new StringWriter(); myRenderer.Render(writer); string result = writer.ToString(); Console.Write(result); int lineCount = result.Count(c => c == '\n'); Assert.AreEqual(4, lineCount); }
public void RenderTwoPatterns() { var renderer = new PatternRenderer(); var data = Data(); var result = renderer.ListPatterns(data); Console.Write(result); var lineCount = result.Count(c => c.Equals('\n')); Assert.AreEqual(4, lineCount); }
public void RenderTwoPatterns() { var patternCollectionAdapter = new PatternCollectionDbAdapter(); var myRenderer = new PatternRenderer(patternCollectionAdapter); var writer = new StringWriter(); myRenderer.Render(writer); string result = writer.ToString(); Console.Write(result); int lineCount = result.Count(c => c == '\n'); Assert.AreEqual(4, lineCount); }
public void UseDataPetternAdapter() { var patterns = new List <Pattern>(); patterns.Add(new Pattern() { Id = 1, Name = "MyFirst", Description = "My first description" }); patterns.Add(new Pattern() { Id = 2, Name = "MySecond", Description = "My second description" }); PatternRenderer adapter = new PatternRenderer(); var result = adapter.ListPatterns(patterns); Assert.AreEqual(4, result.Count(x => x == '\n')); }
public void PatterList_CanUseAdapter_ReturnsCorrectLineCount() { var patterns = new List <Pattern>() { new Pattern() { Id = 1, Name = "Adapter", Description = "Make it fit" }, new Pattern() { Id = 1, Name = "Singleton", Description = "There can only be one" } }; var patternRenderer = new PatternRenderer(); var result = patternRenderer.ListPatterns(patterns); Assert.Equal(4, result.Count(c => c == '\n')); }
public void RenderOneRowGivenOnePatternInList() { var pattern = new Pattern { Id = 1, Name = "A Pattern", Description = "Test object for testing." }; var patterns = new List <Pattern>() { pattern }; var renderer = new PatternRenderer(new DataPatternRenderer()); var result = renderer.ListPatterns(patterns); Approvals.Verify(result); }
public void RenderTwoPatterns() { var myRenderer = new PatternRenderer(); var myList = new List <Pattern> { new Pattern { Id = 1, Name = "Pattern One", Description = "Pattern One Description" }, new Pattern { Id = 2, Name = "Pattern Two", Description = "Pattern Two Description" } }; string result = myRenderer.ListPatterns(myList); Console.Write(result); int lineCount = result.Count(c => c == '\n'); Assert.AreEqual(myList.Count + 2, lineCount); }
public void render_two_patterns() { var patternRenderer = new PatternRenderer(); var list = new List <Pattern> { new Pattern { Id = 1, Name = "Pattern One", Description = "Pattern One Description" }, new Pattern { Id = 2, Name = "Pattern Two", Description = "Pattern Two Description" } }; string result = patternRenderer.ListPatterns(list); output.WriteLine(result); int lineCount = result.Count(c => c == '\n'); lineCount.ShouldBe(list.Count + 2); }