Пример #1
0
        public void MicrodocumTests_Should_AnalizeDTO()
        {
            //Given
            var theme = new DefaultTheme();
            var a     = new AssemblyAnalizer <DefaultLinkStyle>(theme);
            var asm   = AppDomain.CurrentDomain.GetAssemblies();
            //When
            var c = a.Analize(asm, theme.GetAvailableThemeAttributes());

            //Then
            Assert.True(c.Nodes.Count > 0, "c.Nodes.Count > 0");
        }
Пример #2
0
        public void Case5_Should_SplitChains()
        {
            //Given
            var theme = new DefaultTheme();
            var a     = new AssemblyAnalizer <DefaultLinkStyle>(theme);
            var asm   = AppDomain.CurrentDomain.GetAssemblies();
            var c     = a.Analize(asm, theme.GetAvailableThemeAttributes(), t => t.FullName?.StartsWith(/*"MicroDocum.Analyzers.Tests.Case1+"*/ _classname) ?? false);
            //When
            var chains = c.SplitChains();

            //Then
            Assert.That(chains, Has.Count.EqualTo(3));
        }
Пример #3
0
        public void Case1_Should_HaveTTLAttribute()
        {
            //Given
            var theme = new DefaultTheme();
            var a     = new AssemblyAnalizer <DefaultLinkStyle>(theme);
            var asm   = AppDomain.CurrentDomain.GetAssemblies();
            var c     = a.Analize(asm, theme.GetAvailableThemeAttributes(), t => t.FullName?.StartsWith(_classname) ?? false);
            //When
            var graphwizFileData = _gen.Generate(c);

            //Then
            StringAssert.Contains("33", graphwizFileData);
        }
Пример #4
0
        public void Case1_Should_Have4Links()
        {
            //Given
            var theme = new DefaultTheme();
            var a     = new AssemblyAnalizer <DefaultLinkStyle>(theme);
            var asm   = AppDomain.CurrentDomain.GetAssemblies();
            var c     = a.Analize(asm, theme.GetAvailableThemeAttributes(), t => t.FullName?.StartsWith(_classname) ?? false);
            //When
            var graphwizFileData = _gen.Generate(c);

            //Then
            Assert.AreEqual(4, Regex.Matches(Regex.Escape(graphwizFileData), "->").Count);
        }
Пример #5
0
        public void Case5_Should_FindMessageTypes()
        {
            //Given
            var theme = new DefaultTheme();
            var a     = new AssemblyAnalizer <DefaultLinkStyle>(theme);
            var asm   = AppDomain.CurrentDomain.GetAssemblies();
            //When
            var c = a.Analize(asm, theme.GetAvailableThemeAttributes(), t => t.FullName?.StartsWith(/*"MicroDocum.Analyzers.Tests.Case1+"*/ _classname) ?? false);

            //Then
            Assert.That(c.Nodes.Count, Is.EqualTo(10));
            Assert.That(c.Edges.Count, Is.EqualTo(8));
            Assert.That(c.GetSingles(), Has.Count.EqualTo(0), "GetSingles");
            Assert.That(c.GetHeads(), Has.Count.EqualTo(3), "GetHeads");
            Assert.That(c.GetLeafs(), Has.Count.EqualTo(3), "GetLeafs");
        }
Пример #6
0
        public void Case2_Should_FindMessageTypes()
        {
            //Given
            var theme = new DefaultTheme();
            var a     = new AssemblyAnalizer <DefaultLinkStyle>(theme);
            var asm   = AppDomain.CurrentDomain.GetAssemblies();
            //When
            var c = a.Analize(asm, theme.GetAvailableThemeAttributes(), t => t.FullName?.StartsWith(_classname) ?? false);

            //Then
            Assert.That(c.Nodes, Has.Exactly(4).Items);
            Assert.That(c.Edges, Has.Count.EqualTo(1));
            Assert.That(c.GetSingles(), Has.Count.EqualTo(2), "GetSingles");
            Assert.That(c.GetHeads(), Has.Count.EqualTo(1), "GetHeads");
            Assert.That(c.GetLeafs(), Has.Count.EqualTo(1), "GetLeafs");
        }
Пример #7
0
        public void Case1_Should_GenerateFile()
        {
            //Given
            var theme = new DefaultTheme();
            var a     = new AssemblyAnalizer <DefaultLinkStyle>(theme);
            var asm   = AppDomain.CurrentDomain.GetAssemblies();
            var c     = a.Analize(asm, theme.GetAvailableThemeAttributes(), t => t.FullName?.StartsWith(_classname) ?? false);

            Assume.That(c.Nodes, Has.Exactly(3).Items);
            Assume.That(c.Edges, Has.Count.AtLeast(4));
            Assume.That(c.GetSingles(), Has.Count.EqualTo(0), "GetSingles");
            Assume.That(c.GetHeads(), Has.Count.EqualTo(1), "GetHeads");
            Assume.That(c.GetLeafs(), Has.Count.EqualTo(0), "GetLeafs");
            //When
            var graphwizFileData = _gen.Generate(c);

            //Then
            DrawAnSave(graphwizFileData);
        }
Пример #8
0
        public void MicrodocumTests_Should_GenerateGraphwiz()
        {
            //Given
            var theme = new DefaultTheme();
            var a     = new AssemblyAnalizer <DefaultLinkStyle>(theme);
            var asm   = AppDomain.CurrentDomain.GetAssemblies();
            var c     = a.Analize(asm, theme.GetAvailableThemeAttributes());
            var gen   = new GraphvizDotGenerator <DefaultLinkStyle>(new DefaultTheme());
            //When
            var graphwizFileData = gen.Generate(c);

            //Then
            Assert.True(!string.IsNullOrWhiteSpace(graphwizFileData));
            var path = Directory.GetCurrentDirectory();

            path = Path.Combine(path, "DTO_routing.dot");
            using (var file = new StreamWriter(path, false))
            {
                file.Write(graphwizFileData);
                _outputHelper.WriteLine("saved to " + path);
            }
        }