This file contains hidden or 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
| require 'minitest/autorun' | |
| class TestDeck < MiniTest::Unit::TestCase | |
| def test_that_deck_has_52_cards | |
| deck = Deck.new | |
| assert_equal 52, deck.cards.count | |
| end | |
| def test_that_deck_is_shuffled |
This file contains hidden or 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
| require 'minitest/autorun' | |
| require 'date' | |
| class TestWeekdayCounter < MiniTest::Unit::TestCase | |
| def test_number_of_tuesdays_in_june_2014_should_be_4 | |
| thisMonth = Date.new(2014, 6, 1) | |
| nextMonth = Date.new(2014, thisMonth.month + 1, 1) - 1 | |
| assert_equal 4, WeekdayCounter.new.get_tuesdays(thisMonth, nextMonth) | |
| end |
This file contains hidden or 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
| require 'minitest/autorun' | |
| # Test case provided by: http://en.wikipedia.org/wiki/Standard_deviation | |
| class TestStandardDeviation < MiniTest::Unit::TestCase | |
| def setup | |
| @values = [2, 4, 4, 4, 5, 5, 7, 9] | |
| end | |
| def test_average_is_calculated | |
| average = @values.inject{ |memo, element| memo + element} / @values.length |
This file contains hidden or 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
| HASH="%C(yellow)%h%C(reset)" | |
| RELATIVE_TIME="%C(green)%ar%C(reset)" | |
| AUTHOR="%C(bold blue)%an%C(reset)" | |
| REFS="%C(red)%d%C(reset)" | |
| SUBJECT="%s" | |
| FORMAT="$HASH $RELATIVE_TIME $AUTHOR $REFS $SUBJECT" | |
| function pretty_git_log() { | |
| git log --graph --pretty="tformat:$FORMAT" |
This file contains hidden or 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
| string[] existingFiles = Directory.GetFiles(ProcessPath, "*.xml"); | |
| foreach (string fileName in existingFiles) | |
| { | |
| FileInfo fi = new FileInfo(fileName); | |
| FileStream fs = null; | |
| while (fs == null && fi.Exists) | |
| { | |
| try | |
| { | |
| fs = fi.Open(FileMode.Open, FileAccess.Read, FileShare.None); |
This file contains hidden or 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
| Console.Out.WriteLine(string.Join(", ", GetType().Assembly.GetManifestResourceNames())); |
This file contains hidden or 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
| public void CompareTwoXmlFilesInMemory() | |
| { | |
| using (MemoryStream diffgram = new MemoryStream()) | |
| { | |
| XmlTextWriter diffgramWriter = new XmlTextWriter(new StreamWriter(diffgram)); | |
| XmlDiff xmldiff = | |
| new XmlDiff(XmlDiffOptions.IgnoreChildOrder | XmlDiffOptions.IgnoreNamespaces | XmlDiffOptions.IgnorePrefixes); | |
| bool identical = xmldiff.Compare(@"appconfig2.xml", @"appconfig3.xml", false, diffgramWriter); |
This file contains hidden or 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 NUnit.Framework; | |
| using Rhino.Mocks; | |
| namespace ScratchPad | |
| { | |
| [TestFixture] | |
| public class TicketMachineTest | |
| { | |
| [Test] | |
| public void ShouldReserveTheNumberofTicketsInputtedWhenTheUserSubmitsARequest() |
This file contains hidden or 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 file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <xsl:stylesheet version="1.0" | |
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"> | |
| <xsl:output method="xml" indent="yes" /> | |
| <xsl:template match="@*|node()"> | |
| <xsl:copy> | |
| <xsl:apply-templates select="@*|node()"/> |