Welcome to MSDN Blogs Sign in | Join | Help

T4 Editor Beta Released

The folks at Clarius have an update to their T4 template editor. They're now in Beta. It's a very useful editor for anyone doing large amounts of T4 template editing with good factoring of template code vs script and color coding of keywords.
Posted by PedroSilva | 2 Comments
Filed under:

DSL Tools Forum Moved

In case you're looking for the DSL Tools forum and can't find it at its last location, it has moved into the VSX (stands for Visual Studio Extensibility :) forum, so you can ask your DSL-related questions there. And, here's the new link: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=57&SiteID=1.
Posted by PedroSilva | 1 Comments
Filed under: ,

Testing When Exceptions Are Expected

Been thinking about and looking at unit testing a lot recently. And, one of the items that came up was how do you test for expected exceptions to make sure that they're being thrown correctly. So, I wrote of few tests that did just that and noticed how similar they were, so I decided to create a helper method that exposed this test for easy use in all of my tests. These examples are all using the unit test framework that's part of VSTS, but the concept could be used for other C# based unit test tools.

The method uses an anonymous delegate to allow the caller to provide the code that should throw the exception, and wraps all the exception handling and test validation around it in the helper. The following is the code for the exception testing method:

namespace BlogLibraryTests

{

    /// <summary>

    /// Helper class that provides methods for helping unit test development, like handling

    /// expected exceptions and serialization of classes.

    /// </summary>

    internal static class UnitTestHelper

    {

        #region Exception Handling Helpers

        public delegate void ExceptionTestDelegate();

 

        /// <summary>

        /// Tests method for an expected exception being thrown.

        /// </summary>

        /// <param name="del"></param>

        /// <param name="exception"></param>

        static public void TestException(ExceptionTestDelegate del, Type exception)

        {

            try

            {

                // Call the delegate, fail the test if it doesn't throw an exception.

                del();

                Assert.Fail("Test should have thrown exception " + exception.ToString() + ".");

            }

            catch (AssertFailedException)

            {

                // If it's a failed assert, then just rethrow because it's our failure above.

                throw;

            }

            catch (Exception e)

            {

                // Test that the method threw the exception that we were expecting.

                Assert.IsInstanceOfType(e, exception, "Exception is not of the expected type.", exception.ToString());

            }

        }

        #endregion

 

    }

}

The code above will ensure that an exception was actually thrown, or fail otherwise. And, if there was an exception, that it's the type of exception that we were expecting. Not an overly complex amount of code, but very repetitive for every method that you're testing that throws an exception.  

Then calling it is just a matter of providing a delegate with the code that should throw the exception and the expected exception type:

        /// <summary>

        ///A test for NamedElement (string)

        ///</summary>

        [TestMethod()]

        public void ConstructorTest()

        {

            // Test with valid name string.

            string expected = "Foo";

            string name = expected;

            NamedElement target = new NamedElement(name);

 

            Assert.AreEqual(target.Name, expected, "NamedElement(name) didn't initialize correctly.");

 

            // Test with null name string.

            UnitTestHelper.TestException(delegate() { target = new NamedElement(null); }, typeof(ArgumentNullException));

        }

As you can see it makes for compact test writing and makes it easy to create a bunch of tests that ensure that your code throws the appropriate exceptions. 

 

Posted by PedroSilva | 8 Comments
Filed under: ,

Team Architect Power Tools August 2007 CTP

Suhail, one of the members of VS Team Architect, just posted about a new power tool for the Distributed System Designers. This tool lets you visualize class libraries in the Application Designer and System Designer. It's a very useful addition to those tools, but you can read more details about it on the Team Architect blog.

SkyDrive Beta Today

The latest Windows Live service just went into Beta this morning - SkyDrive. SkyDrive is a hard drive in the cloud that lets you save personal files out on the web. Along with private folders that only you can access, it also lets you create shared folders that can be viewed by other registered users or completely public for everyone to see. This will be a really cool service for backing up some data files that you need to share across machines. And, it could definitely be the basis for some interesting content sharing applications between a web of friends. It will be interesting to see this Beta and the tools that come out around it.
Posted by PedroSilva | 0 Comments
Filed under: ,

Microsoft Moves Ahead with Software Modeling

There's an interesting story in eWeek about Microsoft's work on Software Modeling. A lot of discussion about the future, but DSL Tools is really the present and the tip of the spear for a lot of the work that Microsoft is doing in software modeling. As the DSL runtime evolves we'll get more functionality that will help with modeling, including integrating DSLs in more closely with Software Factories.

 Also, as more groups begin producing models based on DSLs, we'll start to see a real ecosystem of designers that can be used, reused for specific purposes, and extended by customers.

So, what do you as customers think of the move to software modeling? And, coding by designers and factories? Is this really where the future of software development is heading? I'd love to hear your thoughts on the matter...

Posted by PedroSilva | 3 Comments
Filed under: ,

DM of the Rings

For those of you Lord of the Ring fans and role-playing game fans... I'm sure those two groups overlap by quite a bit... :)

Here is a funny look at the two merged in a strip.

Posted by PedroSilva | 1 Comments
Filed under:

Extending Distributed System Designers

Clemens has make some very interesting extensions to the Distributed System Designers in TeamSystem Architect edition to do richer code generation than was comes with the product. He described what he's done in detail in his blog.

DSL Designer for WIX

Mark passed around a link to a cool new DSL that lets you generate the WIX for a setup project from a diagram (or model) of your set of applications. This looks like a really cool use of DSL Tools, and it's on CodePlex for anyone that wants to have a look...

This got me thinking... There's been a lot of talk about the DSL runtime itself. But, I was interested in what DSL designers are being created out there by our customers. So, if you've been working on a cool DSL let me know. And, I'll try to put together a list of the other cool designers that are out there.

Posted by PedroSilva | 1 Comments
Filed under:

T4 Editor by Clarius

Clarius has recently released their latest version of a T4 template editor - something quite useful for those DSL authors doing very much code generation. The editor includes:

-          Syntax coloring

-          Intellisense/Code completion

-          Collapsible regions of code blocks

-          Design-time preview of your transformation with dynamic properties support through the Properties window.

 

Posted by PedroSilva | 0 Comments
Filed under:

DSL Tools for Orcas

In case you've all been wondering what has been happening with DSL Tools since v1 shipped, we've been working on getting it into the Orcas releases. The DSL runtime is now in the VS box itself, so it's no longer necessary to install the runtime with your designers. And, the new runtime has been in the latest CTP and Betas of Orcas. The DSL authoring is still shipping as part of the VS SDK, and was recently release in the VS SDK Orcas June CTP. You can get it from MSDN Download Center.
Posted by PedroSilva | 0 Comments
Filed under:

DSL Designer Screenshots

Kristoffer, a UI designer working with the DSL Tools team, recently posted a screen shot and some questions about the new DSL Designer that we're working on. If you'd like a sneak peek, have a look. Also, if you have any comments for him about the new design, leave him a comment.
Posted by PedroSilva | 1 Comments
Filed under:

ListView Performance Posts

I've been reading a series of ListView performance posts by HippieTim. He's done a really good job of showing different ways of using ListViews and how they perform compared to one another. And, recommendations for getting good perf with your ListView.

I'm really intrigued by the virtual ListView option for really long lists. I'm going to give that one a try in the near future.

I don't know if he has more posts planned on this topic, but I'll be keeping an eye out for some more - just in case.

Posted by PedroSilva | 0 Comments
Filed under:

Funny Thing Happened While I Was Walking Down the Hallway

I was walking down the hallway, heading home yesterday evening, and I see Ali jumping across the hallway from his office into another office with an open door. I'm thinking: hmm, that's a little strange. Why would he be doing that? But, apparently, his blog explains all... :)
Posted by PedroSilva | 0 Comments
Filed under:

C# For XBox 360 Development

There have been lots of great news from the Game Developer's Conference this year. But, my favorite thus far is the announcement that C# will be supported in XNA for developing games for the XBox 360. I think this is great and will allow small companies to quickly create games for XBox. Tie that to the XBox Live market place for casual games, and small developers will have a good way of distributing these games too.
Posted by PedroSilva | 0 Comments
Filed under:
More Posts Next page »
 
Page view tracker