This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ellipse = new Ellipse | |
{ | |
Fill = Brushes.Red, | |
StrokeThickness = 2, | |
Stroke = Brushes.Black, | |
Height = _glyphSize, | |
Width = _glyphSize | |
}; | |
return ellipse; //its as UIElement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thought this would work | |
ToolTip objTooltip = new ToolTip(); | |
//set background color | |
objTooltip.Background = new LinearGradientBrush(Color.FromRgb(100, 120, 130), | |
Color.FromRgb(200, 220, 230), 0); | |
//Set border color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (short i = 1; i <= projectItem.FileCount; i++) | |
{ | |
var filename = projectItem.FileNames[i]; | |
if (filename != null && filename.ToLower() == path) //SERIOUSLY WTF YOU TOLD ME YOU HAVE ONE AND RETURN ME NULL? | |
{ | |
return projectItem; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\ack\src\AutoTestExtensions>"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build Obfuscation\Aut | |
oTest.VS.saproj | |
SmartAssembly v6.0.0.513 | |
Copyright © Red Gate Software 2005-2011 | |
Because I wanna ask you about your girlfriend. I must know who she is, or you would've told me her name. | |
System.NullReferenceException : Object reference not set to an instance of an object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OK so now you have implemented the kata. Your tests should look something like this: | |
We can say that the tests define the object "in a calculus of itself". They are not state based tests, they define how the behaviours of the object interact with each other. | |
To see the real value of this let's introduce some change ... I hear real system's do this occasionally. Because this is a high performance system decimal math is too slow. You now need to use floats instead. | |
Need help on floating point math? Check out: http://www-users.math.umd.edu/~jkolesar/mait613/floating_point_math.pdf | |
You will need to use a non-exact equality... How will this change your code? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Value objects are an important concept in DDD. This kata is made both to learn value objects and to learn better ways of testing. | |
Write a probability value object. It should contain the following methods: | |
Probability CombinedWith(Probability) | |
Probability InverseOf() | |
Probability Either(Probability) | |
if you forget your probability math: | |
Either:P(A) + P(B) - P(A)P(B) | |
CombinedWith: P(A)P(B) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is a sample specification. | |
public SutSpecification<Depositor> when_withdrawing_money_from_empty_account = new SutSpecification<Depositor> | |
{ | |
On = () => new Depositor(13), | |
When = depositor => depositor.Withdraw(50.00m), | |
Expect = | |
{ | |
depositor => depositor.Balance > 0.01m, | |
depositor => depositor.AccountIsOpen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A query specification is intended to be used on a method with a return value. The | |
* general idea is that the Given() will build the SUT. The when() will call the method | |
* returning the methods return value. The expectations are then on the returned value. | |
* | |
* You may wonder how you can assert on the sut after the call. You can't using this | |
* template. This is by design, see CQS by Bertrand Meyer, you should not mutate state | |
* of the object when querying. If you want to break this rule use a more open template | |
* and specialize it. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using Simple.Testing.Framework; | |
namespace Simple.Testing.Example | |
{ | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Sometimes the point of a specification is to show that a given scenario fails. | |
* | |
* A failing specification is similar to a SUT specification. It will return the SUT | |
* from its given method. The SUT will then be passed to the when() method where some | |
* action will happen. It is expected that this action will throw an exception. | |
* | |
* The exception is then passed to the expectations. | |
* | |
* note: if you are doing more complex operations other templates can be used with |
OlderNewer