Пример #1
0
            public void Legal_To_Drive()
            {
                var subject = new BloodAlcoholCalculator {
                    Output = new StringWriter()
                };

                subject.Bac(
                    alcohol: Ounces.FromOunces(4.4f),
                    weight: Pounds.FromPounds(180.0f),
                    gender: Gender.Female,
                    sinceDrink: TimeSpan.FromHours(3));

                Assert.That(subject.Output.ToString(), Is.StringContaining("You are legal to drive."));
            }
Пример #2
0
            public void Illegal_To_Drive()
            {
                var subject = new BloodAlcoholCalculator {
                    Output = new StringWriter()
                };

                subject.Bac(
                    alcohol: Ounces.FromOunces(25.0f),
                    weight: Pounds.FromPounds(100.0f),
                    gender: Gender.Male,
                    sinceDrink: TimeSpan.FromHours(1));

                Assert.That(subject.Output.ToString(),
                            Is.StringContaining("It is not legal for you to drive."));
            }
Пример #3
0
        public void Execute()
        {
            var alcohol         = Input.FloatParse(message: "Alcohol (ounces): ");
            var weight          = Input.FloatParse(message: "Weight (pounds): ");
            var genderInput     = Input.ParseStringMatching(message: "Gender Male/Female: ", expression: "(Male|Female)");
            var hoursSinceDrink = Input.ParseInt(message: "Hours Since Drink: ");

            var calculator = new BloodAlcoholCalculator();

            calculator.Bac(
                Ounces.FromOunces(alcohol),
                Pounds.FromPounds(weight),
                (Gender)Enum.Parse(typeof(Gender), genderInput, ignoreCase: true),
                TimeSpan.FromHours(hoursSinceDrink)
                );
        }
Пример #4
0
 public void Kilograms_To_Pounds(float kilograms, float pounds)
 {
     Assert.That(
         Pounds.FromKilograms(kilograms),
         Is.EqualTo(Pounds.FromPounds(pounds)));
 }
Пример #5
0
 public void Ounce_To_Ounce()
 {
     Assert.That(Pounds.FromPounds(1), Is.EqualTo(Pounds.FromPounds(1)));
 }