コード例 #1
0
        private static Result <IContainer> BuildDependencies(Options options)
        {
            var colors = ColorsParser.ParseColors(options.Colors);

            if (!colors.IsSuccess)
            {
                return(Result.Fail <IContainer>(colors.Error));
            }
            return(BuildDependencies(options.Width, options.Height, colors.Value, options.Input));
        }
コード例 #2
0
ファイル: ColorParserShould.cs プロジェクト: CakeOrRiot/fp
 public void ParseCorrectColors()
 {
     ColorsParser.ParseColors("rgbp").GetValueOrThrow().Should()
     .BeEquivalentTo(new[] { Color.Red, Color.Green, Color.Blue, Color.Purple });
 }
コード例 #3
0
ファイル: ColorParserShould.cs プロジェクト: CakeOrRiot/fp
 public void ReturnError_WhenColorsAreNotCorrect()
 {
     ColorsParser.ParseColors("rfdagad").IsSuccess.Should().BeFalse();
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: CakeOrRiot/di
 private static IContainer BuildDependencies(Options options)
 {
     return(BuildDependencies(options.Width, options.Height,
                              ColorsParser.ParseColors(options.Colors),
                              options.Input));
 }