mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 15:50:49 +08:00 
			
		
		
		
	unit tests passing
This commit is contained in:
		@@ -1,12 +1,16 @@
 | 
			
		||||
namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
    using Ocelot.Configuration.Creator;
 | 
			
		||||
    using Shouldly;
 | 
			
		||||
    using TestStack.BDDfy;
 | 
			
		||||
    using Xunit;
 | 
			
		||||
 | 
			
		||||
    public class VersionCreatorTests
 | 
			
		||||
    {
 | 
			
		||||
        private readonly VersionCreator _creator;
 | 
			
		||||
        private string _input;
 | 
			
		||||
        private Version _result;
 | 
			
		||||
 | 
			
		||||
        public VersionCreatorTests()
 | 
			
		||||
        {
 | 
			
		||||
@@ -16,19 +20,35 @@
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void should_create_version_based_on_input()
 | 
			
		||||
        {
 | 
			
		||||
            var input = "2.0";
 | 
			
		||||
            var result = _creator.Create(input);
 | 
			
		||||
            result.Major.ShouldBe(2);
 | 
			
		||||
            result.Minor.ShouldBe(0);
 | 
			
		||||
            this.Given(_ => GivenTheInput("2.0"))
 | 
			
		||||
                .When(_ => WhenICreate())
 | 
			
		||||
                .Then(_ => ThenTheResultIs(2, 0))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void should_default_to_version_one_point_one()
 | 
			
		||||
        {
 | 
			
		||||
            var input = "";
 | 
			
		||||
            var result = _creator.Create(input);
 | 
			
		||||
            result.Major.ShouldBe(1);
 | 
			
		||||
            result.Minor.ShouldBe(1);
 | 
			
		||||
            this.Given(_ => GivenTheInput(""))
 | 
			
		||||
                .When(_ => WhenICreate())
 | 
			
		||||
                .Then(_ => ThenTheResultIs(1, 1))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GivenTheInput(string input)
 | 
			
		||||
        {
 | 
			
		||||
            _input = input;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void WhenICreate()
 | 
			
		||||
        {
 | 
			
		||||
            _result = _creator.Create(_input);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ThenTheResultIs(int major, int minor)
 | 
			
		||||
        {
 | 
			
		||||
            _result.Major.ShouldBe(major);
 | 
			
		||||
            _result.Minor.ShouldBe(minor);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user