예제 #1
0
                public void EmptySource_ShouldReturnDefaultDegreeAngle()
                {
                    // arrange
                    var areas = Enumerable.Empty <DegreeAngle>();

                    // act
                    var result = AngularEnumerableExtensions.Sum(areas);

                    // assert
                    result.Should().Be(default(DegreeAngle));
                }
예제 #2
0
                public void EmptySource_ShouldReturnDefaultDegreeAngle()
                {
                    // arrange
                    var objects = Enumerable.Empty <TestObject <DegreeAngle> >();

                    // act
                    var result = AngularEnumerableExtensions.Sum(objects, e => e.Property);

                    // assert
                    result.Should().Be(default(DegreeAngle));
                }
예제 #3
0
                public void NullSource_ShouldThrow()
                {
                    // arrange
                    IEnumerable <DegreeAngle> areas = null;

                    // act
                    Action sum = () => AngularEnumerableExtensions.Sum(areas);

                    // assert
                    sum.Should().Throw <ArgumentNullException>()
                    .And.ParamName.Should().Be("source");
                }
예제 #4
0
                public void ShouldReturnValidResult()
                {
                    // arrange
                    var    source = Fixture.CreateMany <DegreeAngle>(3).Select(e => new TestObject <DegreeAngle>(e));
                    number expectedResultInMetres = Enumerable.Sum(source, e => e.Property.TotalSeconds);
                    var    expectedResult         = new DegreeAngle(expectedResultInMetres);

                    // act
                    var result = AngularEnumerableExtensions.Sum(source, e => e.Property);

                    // assert
                    result.TotalSeconds.Should().Be(expectedResult.TotalSeconds);
                }
예제 #5
0
                public void NullSelector_ShouldThrow()
                {
                    // arrange
                    var objects = Enumerable.Empty <TestObject <DegreeAngle> >();
                    Func <TestObject <DegreeAngle>, DegreeAngle> selector = null;

                    // act
                    Action sum = () => AngularEnumerableExtensions.Sum(objects, selector);

                    // assert
                    sum.Should().Throw <ArgumentNullException>()
                    .And.ParamName.Should().Be("selector");
                }
예제 #6
0
                public void NullSource_ShouldThrow()
                {
                    // arrange
                    IEnumerable <TestObject <DegreeAngle> >      objects  = null;
                    Func <TestObject <DegreeAngle>, DegreeAngle> selector = e => e.Property;

                    // act
                    Action sum = () => AngularEnumerableExtensions.Sum(objects, selector);

                    // assert
                    sum.Should().Throw <ArgumentNullException>()
                    .And.ParamName.Should().Be("source");
                }
예제 #7
0
                public void ShouldReturnValidResult()
                {
                    // arrange
                    var    source = Fixture.CreateMany <DegreeAngle>(3);
                    number expectedResultInTotalSeconds = Enumerable.Sum(source, e => e.TotalSeconds);
                    var    expectedResult = new DegreeAngle(expectedResultInTotalSeconds);

                    // act
                    var result = AngularEnumerableExtensions.Sum(source);

                    // assert
                    result.TotalSeconds.Should().Be(expectedResult.TotalSeconds);
                }
                public void ShouldReturnValidResult()
                {
                    // arrange
                    var    source = Fixture.CreateMany <RadianAngle>(3);
                    number expectedResultInRadians = Enumerable.Sum(source, e => e.Radians);
                    var    expectedResult          = new RadianAngle(expectedResultInRadians);

                    // act
                    var result = AngularEnumerableExtensions.Sum(source);

                    // assert
                    result.Radians.Should().Be(expectedResult.Radians);
                }