public void Constructor4_ValuesAsErrorsArgument_ShouldSetErrorsProperty()
        {
            var errors = Expectations.GetCompositionErrors();

            foreach (var e in errors)
            {
                var result = new CompositionResult <string>(e);

                Assert.Equal(e, result.Errors);
            }
        }
Example #2
0
        public void Constructor2_ValuesAsErrorsArgument_ShouldSetErrorsProperty()
        {
            var errors = Expectations.GetCompositionErrors();

            foreach (var e in errors)
            {
                var result = new CompositionResult(e.ToArray());

                EnumerableAssert.AreEqual(e, result.Errors);
            }
        }
 public CompositionResult MergeResult(CompositionResult result)
 {
     if (this.Succeeded)
     {
         return(result);
     }
     if (result.Succeeded)
     {
         return(this);
     }
     return(MergeErrors(result._errors));
 }
        public void Constructor5_ValuesAsErrorsArgument_ShouldSetSucceededPropertyToTrueIfThereAreErrors()
        {
            var errors = Expectations.GetCompositionErrors();

            foreach (var e in errors)
            {
                var result = new CompositionResult <string>("Value", e);

                if (e.Count() > 0)
                {
                    Assert.False(result.Succeeded);
                }
                else
                {
                    Assert.True(result.Succeeded);
                }
            }
        }
        public void Constructor5_EmptyAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
        {
            var result = new CompositionResult <string>("Value", Enumerable.Empty <CompositionError>());

            Assert.Empty(result.Errors);
        }
        public void Constructor3_EmptyAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
        {
            var result = new CompositionResult <string>(new CompositionError[0]);

            Assert.Empty(result.Errors);
        }
        public void Constructor4_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
        {
            var result = new CompositionResult <string>((IEnumerable <CompositionError>)null);

            Assert.Empty(result.Errors);
        }
        public void Constructor2_ShouldSetErrorsPropertyToEmptyEnumerable()
        {
            var result = new CompositionResult <string>("Value");

            Assert.Empty(result.Errors);
        }
        public void Constructor5_EmptyAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
        {
            var result = new CompositionResult <string>("Value", Enumerable.Empty <CompositionError>());

            Assert.True(result.Succeeded);
        }
        public void Constructor5_NullAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
        {
            var result = new CompositionResult <string>("Value", (IEnumerable <CompositionError>)null);

            Assert.True(result.Succeeded);
        }
        public void Constructor2_ShouldSetSucceededPropertyToTrue()
        {
            var result = new CompositionResult <string>("Value");

            Assert.True(result.Succeeded);
        }
        public void Constructor1_ShouldSetErrorsPropertyToEmptyEnumerable()
        {
            var result = new CompositionResult <string>();

            EnumerableAssert.IsEmpty(result.Errors);
        }
        public void Constructor3_NullAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
        {
            var result = new CompositionResult <string>((CompositionError[])null);

            Assert.IsTrue(result.Succeeded);
        }
Example #14
0
        public void Constructor1_ShouldSetSucceededPropertyToTrue()
        {
            var result = new CompositionResult();

            Assert.True(result.Succeeded);
        }
Example #15
0
        public void Constructor2_NullAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
        {
            var result = new CompositionResult((CompositionError[])null);

            Assert.Empty(result.Errors);
        }
        public void Constructor3_EmptyAsErrorsArgument_ShouldSetSucceededPropertyToTrue()
        {
            var result = new CompositionResult <string>(new CompositionError[0]);

            Assert.True(result.Succeeded);
        }
Example #17
0
        public void Constructor3_EmptyAsErrorsArgument_ShouldSetErrorsPropertyToEmptyEnumerable()
        {
            var result = new CompositionResult(Enumerable.Empty <CompositionError>());

            EnumerableAssert.IsEmpty(result.Errors);
        }