private IFlexibleWordCountModel GetCountsFromText(Text text) { WordCount withQuotes = _db.WordCounts.FirstOrDefault(x => x.Id == text.WithQuotesId); WordCount withoutQuotes = _db.WordCounts.FirstOrDefault(x => x.Id == text.WithoutQuotesId); if (withQuotes == null || withoutQuotes == null) { throw new ArgumentException("One of the Counts entities is missing."); } ISingleWordCountModel withQuotesModel = TranslateCounts(withQuotes); ISingleWordCountModel withoutQuotesModel = TranslateCounts(withoutQuotes); return(_modelFactory.GetFlexibleCountModel(withQuotesModel, withoutQuotesModel)); }
public void Initialize() { _modelFactory = new ModelFactory(); int[] countsWithQuotes = new int[] { 0, 3, 1, 4, 2, 5 }; int[] countsWithoutQuotes = new int[] { 6, 9, 7, 10, 8, 11 }; ISingleWordCountModel withQuotes = _modelFactory.GetSingleCountModel(countsWithQuotes); ISingleWordCountModel withoutQuotes = _modelFactory.GetSingleCountModel(countsWithoutQuotes); wordCountModel = _modelFactory.GetFlexibleCountModel(withQuotes, withoutQuotes); nullWordCountModel = null; model = new TextModel("model", wordCountModel); }
public void Initialize() { _modelFactory = new ModelFactory(); var countsOne = new int[] { 1, 2, 3, 4, 5 }; var countsTwo = new int[] { 7, 8, 9, 10, 11 }; var countsThree = new int[] { 100, 101, 102, 103, 104 }; var countsWrongLength = new int[] { 55 }; var groupCountsBadInitialization = new int[] { 7, 7, 7, 7, 7 }; var countsWithQuotesOne = _modelFactory.GetSingleCountModel(countsOne); var countsWithQuotesTwo = _modelFactory.GetSingleCountModel(countsTwo); var countsWithQuotesThree = _modelFactory.GetSingleCountModel(countsThree); var countsWithQuotesWrongLength = _modelFactory.GetSingleCountModel(countsWrongLength); var countsWithoutQuotesOne = _modelFactory.GetSingleCountModel((int[])countsOne.Clone()); var countsWithoutQuotesTwo = _modelFactory.GetSingleCountModel((int[])countsTwo.Clone()); var countsWithoutQuotesThree = _modelFactory.GetSingleCountModel((int[])countsThree.Clone()); var countsWithoutQuotesWrongLength = _modelFactory.GetSingleCountModel((int[])countsWrongLength.Clone()); badCountInitialization = _modelFactory.GetSingleCountModel(groupCountsBadInitialization); var flexibleCountsOne = _modelFactory.GetFlexibleCountModel(countsWithQuotesOne, countsWithoutQuotesOne); var flexibleCountsTwo = _modelFactory.GetFlexibleCountModel(countsWithQuotesTwo, countsWithoutQuotesTwo); var flexibleCountsThree = _modelFactory.GetFlexibleCountModel(countsWithQuotesThree, countsWithoutQuotesThree); var flexibleCountsWrongLength = _modelFactory.GetFlexibleCountModel(countsWithQuotesWrongLength, countsWithoutQuotesWrongLength); textOne = _modelFactory.GetTextModel("text one", flexibleCountsOne); textTwo = _modelFactory.GetTextModel("text two", flexibleCountsTwo); textThree = _modelFactory.GetTextModel("text three", flexibleCountsThree); textWrongLength = _modelFactory.GetTextModel("text wrong length", flexibleCountsWrongLength); groupOne = _modelFactory.GetGroupModel("group one", 5); groupTwo = _modelFactory.GetGroupModel("group two", 5); }
public void Initialize() { _modelFactory = new ModelFactory(); int[] countsOne = new int[] { 1, 2, 3, 4, 5 }; singleCountIncludeQuotes = _modelFactory.GetSingleCountModel(countsOne); int[] countsTwo = new int[] { 1, 14, 3, 28, 5 }; singleCountExcludeQuotes = _modelFactory.GetSingleCountModel(countsTwo); singleCountNull = null; int[] countsLengthOne = new int[] { 55 }; singleCountLengthOne = _modelFactory.GetSingleCountModel(countsLengthOne); int[] countsLengthZeroA = new int[0]; singleCountLengthZeroA = new FakeSingleWordCountModel(countsLengthZeroA); int[] countsLengthZeroB = new int[0]; singleCountLengthZeroB = new FakeSingleWordCountModel(countsLengthZeroB); int[] countsWithNegative = new int[] { 1, -2, 3, 4, 5 }; singleCountNegativeCount = new FakeSingleWordCountModel(countsWithNegative); flexibleWordCountModel = _modelFactory.GetFlexibleCountModel(singleCountIncludeQuotes, singleCountExcludeQuotes); }
public void ValidConstruction() { flexibleWordCountModel = _modelFactory.GetFlexibleCountModel(singleCountIncludeQuotes, singleCountExcludeQuotes); }