Getting Instances of RomanFigure

Parse types

Instances can be parsed from string, char and short.

Story is parse a char
  In order to get a figure instance
  As a library user
  I want to be able to parse a char

      With scenario parse a defined figure
        Given a character I                   => Passed
        When the char is parsed               => Passed
        Then the figure I is                  => Passed

      With scenario parse an undefined figure
        Given a character W                   => Passed
        When the char is parsed               => Passed
        Then throws argument exception        => Passed

      With scenario figures are unique
        Given a character X                   => Passed
        When the char is parsed again X       => Passed
        Then is the same figure               => Passed

Story is parse a number
  In order to get a figure instance
  As a library user
  I want to be able to parse a short

      With scenario parse a defined figure
        Given a number 1                      => Passed
        When the number is parsed             => Passed
        Then the figure I is                  => Passed

      With scenario parse an undefined figure
        Given a number 3                      => Passed
        When the number is parsed             => Passed
        Then throws argument exception        => Passed

      With scenario figures are unique
        Given a number 10                     => Passed
        When the number is parsed again 10    => Passed
        Then is the same figure               => Passed

Story is parse a string
  In order to get a figure instance
  As a library user
  I want to be able to parse a string

      With scenario parse a defined figure
        Given a string I                              => Passed
        When the string is parsed                     => Passed
        Then the figure I is                          => Passed

      With scenario parse an undefined figure
        Given a string W                              => Passed
        When the string is parsed                     => Passed
        Then throws argument exception                => Passed

      With scenario parse a multiple character string
        Given a string XI                             => Passed
        When the string is parsed                     => Passed
        Then throws format exception                  => Passed

      With scenario figures are unique
        Given a string X                              => Passed
        When the string is parsed again X             => Passed
        Then is the same figure                       => Passed

Casting

Instances can be obtained by casting a char
Story is conversion from char
  In order to get the figure from a character
  As a library user
  I want to be able to cast a character

      With scenario figure of a defined character
        Given a character N                          => Passed
        When the figure is obtained                  => Passed
        Then the figure N is                         => Passed

      With scenario figure of a defined character
        Given a character I                          => Passed
        When the figure is obtained                  => Passed
        Then the figure I is                         => Passed

      With scenario figure of a defined character
        Given a character V                          => Passed
        When the figure is obtained                  => Passed
        Then the figure V is                         => Passed

      With scenario figure of a defined character
        Given a character X                          => Passed
        When the figure is obtained                  => Passed
        Then the figure X is                         => Passed

      With scenario figure of a defined character
        Given a character L                          => Passed
        When the figure is obtained                  => Passed
        Then the figure L is                         => Passed

      With scenario figure of a defined character
        Given a character C                          => Passed
        When the figure is obtained                  => Passed
        Then the figure C is                         => Passed

      With scenario figure of a defined character
        Given a character D                          => Passed
        When the figure is obtained                  => Passed
        Then the figure D is                         => Passed

      With scenario figure of a defined character
        Given a character M                          => Passed
        When the figure is obtained                  => Passed
        Then the figure M is                         => Passed

      With scenario figure of an undefined character
        Given a character W                          => Passed
        When the figure is obtained                  => Passed
        Then throws argument exception               => Passed

      With scenario figures are unique
        Given a character X                          => Passed
        When the figure is obtained for X            => Passed
        Then is the same figure                      => Passed

Instances can be obtained by casting a short
Story is conversion from short
  In order to convert short value to a roman figure
  As a library user
  I want to be able to cast from a short

      With scenario value of a figure
        Given a number 0                            => Passed
        When the figure is obtained                 => Passed
        Then the figure N is correct                => Passed

      With scenario value of a figure
        Given a number 1                            => Passed
        When the figure is obtained                 => Passed
        Then the figure I is correct                => Passed

      With scenario value of a figure
        Given a number 5                            => Passed
        When the figure is obtained                 => Passed
        Then the figure V is correct                => Passed

      With scenario value of a figure
        Given a number 10                           => Passed
        When the figure is obtained                 => Passed
        Then the figure X is correct                => Passed

      With scenario value of a figure
        Given a number 50                           => Passed
        When the figure is obtained                 => Passed
        Then the figure L is correct                => Passed

      With scenario value of a figure
        Given a number 100                          => Passed
        When the figure is obtained                 => Passed
        Then the figure C is correct                => Passed

      With scenario value of a figure
        Given a number 500                          => Passed
        When the figure is obtained                 => Passed
        Then the figure D is correct                => Passed

      With scenario value of a figure
        Given a number 1000                         => Passed
        When the figure is obtained                 => Passed
        Then the figure M is correct                => Passed

      With scenario undefined value
        Given a number 55                           => Passed
        When the figure is obtained                 => Passed
        Then throws argument exception              => Passed

Last edited Dec 30, 2011 at 5:05 PM by dgon, version 1

Comments

No comments yet.