public void should_be_valid_because_host_set()
        {
            var fileHostAndPort = new FileHostAndPort
            {
                Host = "test"
            };

            this.Given(_ => GivenThe(fileHostAndPort))
            .When(_ => WhenIValidate())
            .Then(_ => ThenTheResultIsValid())
            .BDDfy();
        }
        public void should_be_invalid_because_host_empty(string host)
        {
            var fileHostAndPort = new FileHostAndPort
            {
                Host = host
            };

            this.Given(_ => GivenThe(fileHostAndPort))
            .When(_ => WhenIValidate())
            .Then(_ => ThenTheResultIsInValid())
            .And(_ => ThenTheErorrIs())
            .BDDfy();
        }
Пример #3
0
        private List <FileHostAndPort> MapperHostAndPortList(string sourceString)
        {
            var list = new List <FileHostAndPort>();

            if (!string.IsNullOrWhiteSpace(sourceString))
            {
                var sourceList = sourceString.Split(',').ToList();
                foreach (var source in sourceList)
                {
                    var current = source.Split(':');
                    if (current != null && current.Length == 2)
                    {
                        var hostAndPort = new FileHostAndPort();
                        hostAndPort.Host = current[0];
                        hostAndPort.Port = int.Parse(current[1]);
                        list.Add(hostAndPort);
                    }
                }
            }
            return(list);
        }
 private void GivenThe(FileHostAndPort hostAndPort)
 {
     _hostAndPort = hostAndPort;
 }