public void BetaOfFloatList_SourceIsNull_ArgumentNullExceptionThrown() { IEnumerable <BetaSampleItem <float> > source = DataGenerator.CreateBetaSampleItemsList <float>(); IEnumerable <float> measure1 = null; IEnumerable <float> measure2 = source.Select(x => x.AssetReturn); Action comparison = () => { measure1.Beta(measure2); }; comparison.ShouldThrow <ArgumentNullException>(); measure1 = source.Select(x => x.MarketReturn); measure2 = null; comparison = () => { measure1.Beta(measure2); }; comparison.ShouldThrow <ArgumentNullException>(); }
public void BetaOfFloatList_SourceIsNotEmptyAndTheSameLength_BetaReturned() { IEnumerable <BetaSampleItem <float> > source = DataGenerator.CreateBetaSampleItemsList <float>(); var marketReturns = source.Select(x => x.MarketReturn); var assetReturns = source.Select(x => x.AssetReturn); marketReturns.Beta(assetReturns).Should().Be(0.7275786672584273763846257811F); }
public void BetaOfFloatProperty_SelectorIsNull_ArgumentNullExceptionThrown() { IEnumerable <BetaSampleItem <float> > source = DataGenerator.CreateBetaSampleItemsList <float>(); Func <BetaSampleItem <float>, float> selector = null; Action comparison = () => { source .OrderBy(x => x.ReferenceDate) .Beta(selector, x => x.AssetReturn); }; comparison.ShouldThrow <ArgumentNullException>(); comparison = () => { source .OrderBy(x => x.ReferenceDate) .Beta(x => x.MarketReturn, selector); }; comparison.ShouldThrow <ArgumentNullException>(); }
public void BetaOfFloat_SourceIsNotEmpty_BetaReturned() { IEnumerable <BetaSampleItem <float> > source = DataGenerator.CreateBetaSampleItemsList <float>(); source.Beta(x => x.MarketReturn, x => x.AssetReturn).Should().Be(0.7275786672584273763846257811F); }
public void BetaOfDouble_SourceIsNotEmpty_BetaReturned() { IEnumerable <BetaSampleItem <double> > source = DataGenerator.CreateBetaSampleItemsList <double>(); source.Beta(x => x.MarketReturn, x => x.AssetReturn).Should().Be(0.72757866725842668); }