public void ShouldHaveNullResultWhenConverting()
 {
     GivenDataDictionary = new Dictionary <string, object> {
         { "Name", "Jane Doe" }
     };
     WhenConverting();
     ThenResult.Should().BeNull();
     ThenSuccess.Should().BeFalse();
 }
        public void ShouldHaveNullResultWhenConvertingGivenNoValidConverters()
        {
            GivenDataDictionary = new Dictionary <string, object> {
                { "Name", "Jane Doe" }
            };
            GivenConversionTo = typeof(string);

            WhenConverting();

            ThenResult.Should().BeNull();
            ThenSuccess.Should().BeFalse();
        }
        public void ShouldHaveValidResultWhenConvertingToAKnownConverterType()
        {
            GivenDataDictionary = new Dictionary <string, object> {
                { "Name", "Jane Doe" }
            };
            GivenConversionTo = typeof(string);
            GivenConverter    = dct => string.Join(", ", dct.Keys.Select(key => key + "=" + dct[key]));

            WhenConverting();

            ThenSuccess.Should().BeTrue();
            ThenResult.Should().BeAssignableTo <string>();
            ThenResult.Should().NotBeNull().And.Be("Name=Jane Doe");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Run async the definition of the SceneContext.
        /// <see cref="SceneContext{TGiven, TWhen, TThen, TFunc_Given}"/>
        /// Execute the steps
        /// </summary>
        /// <typeparam name="TThen">Type of then-methods class</typeparam>
        /// <param name="then">ThenResult object</param>
        public static Task RunAsync <TThen>(this ThenResult <TThen, Func <Task> > then)
        {
            var scene = (Scene <Func <Task> >)then.To();

            return(scene.Runner.RunScenarioAsync(scene.End()));
        }