In this article I will introduce you to the UML Sequence Diagrams. UML, as you now stands for Unified Modeling Language. So why sequence diagrams can be useful? Recently I have been working on legacy project. And sequence diagram can really help you to figure out the application calling sequence. Let's take this piece of code. public partial class About : System.Web.UI. Page { protected void Page_Load( object sender, EventArgs e) { var authorService = new AuthorService (); this .Title = authorService.GetServerDateTime().ToString(); } } I believe that one picture is better that 100 words. So here is the same code but in UML Sequence Digram. Simple UML Seque...
Sometimes you could see arrows(=tabs) and dots(=spaces) in your Visual Studio Editor. Now the nice question is how to remove them...? If you do search over the options you probably will not find a way how to do that. The solution is simple but hidden. Just press CTRL R CTRL W in your Editor. That's it.
MS Unit Test and NUnit have method Assert.AreEqual(object o1, object o2). What they can do - is simply compare integers or strings, etc. But they do not compare complex object. I have used different code, but a lot of them do not correctly compare really complex objects(Like object with nested object, or list, or enum). The solution is to use http://comparenetobjects.codeplex.com/ C# class. It is pretty simple one .cs file and it works! public static void CompareObjectValues(object o1, object o2, IEnumerable<string> elementsToIgnore) { var compareObjects = new CompareObjects(); compareObjects.MaxDifferences = 100; compareObjects.ElementsToIgnore.AddRange(elementsToIgnore); var comp = compareObjects.Compare(o1, o2); if (comp == false) { Assert.Fail(compareObjects.DifferencesString); } Assert.IsTrue(comp); }
Comments
Post a Comment