|
|
Browse by Tags
All Tags » .NET (RSS)
-
So in part 1 we created our own constraint and want some of that syntax sugar, the Is helper class uses static (shared) methods to create the constraints so we either hack the NUnit source or try something else. What I ended up doing may not be ideal as it really plays with the syntax but it was fun all the same :) I created a new class called This and did the following. Imports System.Collections Imports NUnit.Framework.Constraints Imports NUnit.Framework.SyntaxHelpers Public Class This Inherits SyntaxHelper Public Shared ReadOnly Property [Is]() As This Get Return New This() End Get End Property Public Function AssignableFrom(ByVal expectedType As Type) As Constraint Return New AssignableFromConstraint(expectedType) End Function Public Function AtLeast(ByVal expected As IComparable) As Constraint Return GreaterThanOrEqualTo(expected) End Function Public Function AtMost(ByVal expected As IComparable) As Constraint Return LessThanOrEqualTo(expected) End Function Public Function EqualTo(ByVal Read More...
|
-
Je dois reconnaitre que j'ai découvert très récemment cette collection mais elle semble être bien pratique. En effet, la CompositeCollection vous permet de mélanger plusieurs collections et éléments de façon à ce qu'ils soient affichés comme une seul... Read More...
|
-
NUnit constraints offer a different style to crafting your unit tests, rather than write. Assert.IsEqual( expected,actual ) you could write Assert.That( expected , Is.EqualTo( actual )) Or in VB as Is is a reserved keyword - Assert.That( expected , [Is].EqualTo( actual )) 'Is' is one of the syntax helpers within NUnit.Framework.SyntaxHelpers to add a little syntax sugar, the above could be written as Assert,That(expected, new EqualConstraint( actual )) Where EqualConstraint lives in NUnit.Framework.Constraints but the syntax sugar is so much nicer. The That assert takes a IConstraint interface and if you want to craft your own constraints you can do so by using NUnit's own Constraint class. For our own purposes let's create a custom constraint that tests the cast of null (nothing) to a datetime value. Imports NUnit.Framework Imports NUnit.Framework.Constraints Public Class DateFormatConstraint Inherits Constraint Private testDate As Date Public Sub New() Me.testDate = CType(Nothing, Date) Read More...
|
-
After writing some NUnit tests with the Assert.That constriant syntax my code file was looking a bit messy so I ran R# 'cleanup' and it threw "JetBrains.Util.LoggerException: Cannot create IReferenceExpresion for 'Is' ". After that right click was kept throwing this error and to get around it I had to unload and reload the R# plugin. Not sure if it's VB and the need the escape Is as a reserved keyword but R# was struggling. Read More...
|
-
Je viens de voir passer ce post, sur le blog de Stefan Dobrev, qui devrait faire plaisir à plus d'une personne En effet, il a développé un petit addin à Expression Blend qui lui permet d'avoir... l'Intellisense: Le téléchargement et la procédure... Read More...
|
-
Il peut-être intéressant, dans certains scénarios, de savoir si l'on peut se binder sur une propriété particulière ou de savoir si le mode de binding par défaut de cette propriété est TwoWay. Bien sur, la première solution sera de faire le test et d'... Read More...
|
-
Il est très fréquent que l'on ait besoin, dans son programme, d'ajouter un élément à un ItemsControl (ListBox, ComboBox, etc...). Cela se passe très bien si vous avez indiqué les différents éléments du contrôle mais si vous êtes passé par la propriété... Read More...
|
-
Picture this, large scale enterprise app, small scale legacy application, third party code...in other words a code base you are not fully familar with and need to understand. Sure enough can apply the feathers rules but if your in a hurrry to understand to understand a code base to start making changes (and a green field option is not an option) then what do you do? I'm on the look out for a tool that can allow you to explore a code base, explore object dependencies and pathways. Ideas welcome. Read More...
|
-
Il peut parfois s'avérer nécessaire de vouloir déclencher manuellement un évènement sur un contrôle. En effet, vous pourriez vouloir, par exemple, envoyer l'évènement KeyDown à une ComboBox alors que c'est la fenêtre de votre application qui a le focu... Read More...
|
-
Je ne vais pas vous reparler de NDepend, l'outil développé par Patrick Smacchia, car c'est un outil vraiment très précieux pour tous les développeurs/architectes qui souhaitent avoir des métriques sur le code de leur application. Si vous ne connaisse... Read More...
|
-
While eating my lunch I was running through google reader and started reading a post from Glen , this lead me in turn to Hammett (the guy that founded the Castle project) and this post literally blew me away. Microsoft have been snapping some of the coolest, smartest dudes in the commnity lately, first Haack, then Rob, then Hansleman, now....Hammet. It is a very long time coming, Hammett is a seriously smart dude and fully deserves it. He will be joining them on the MEF team, as that is not directly related to Castle (although I am sure the IoC stuff make use of the MEF) he gets to keep working on the project, very cool. I do wonder when Oren, Jeremy and Jeff (also super smart dudes) will be joining the mother ship, still waiting on my call Scott :D ;-) Read More...
|
-
Imaginez le scénario suivant, très fréquent avec WPF (entre autre): vous disposez d'une ComboBox/ListBox et la source de données de ce contrôle est une "table" générée par LINQ To SQL. Un bouton de votre interface vous permet de supprimer un élément ... Read More...
|
-
Jeff's recent post I cannot repeat enough , with both MbUnit and Gallio we have made sure that we have credited folks where we have reimplemented their ideas and concepts. If they took the time to come up with the concept\idea then we feel it was only right to credit them for that concep\idea, while there may be little legal standing it is a polite and professional thing to do. During my time as V2 lead, Roy contacted me about a failure on our part to credit him for the Rollback attribute in the MbUnit code and we quickly corrected it. It was Roys concept and it was only fair to give notice of that. Me and Jeff have recently noticed several other OSS projects who have copied some of the concepts\ideas from MbUnit\Gallio and we ask that those concerned give us the same consideration. Read More...
|
-
Voila un scénario tout ce qu'il y a de plus simple: vous disposez d'une IHM composée d'une zone de saisie et d'une listbox et vous souhaitez filtrer le contenu de cette listbox en fonction de ce que l'utilisateur insère dans la textbox. Pour faire ce... Read More...
|
-
Il est parfois nécessaire, dans une application Silverlight, de communiquer avec "l'extérieur". Dans la majorité des cas, on aura tendance à utiliser un Web Service mais qu'en est-il lorsque vous souhaitez communiquer avec la page ASP.NET qui héberge ... Read More...
|
|
|
|