Ejemplo n.º 1
0
        public void Should_throw_comparing_to_null()
        {
            using (var context = new ApplicationDbContext(ContextOptions))
            {
                SuggestionList suggestionList = new SuggestionList(5);
                Assert.AreEqual(1, suggestionList.CompareTo(null));

                Assert.Throws <ArgumentException>(() => suggestionList.CompareTo(new Connector(5)));
            }
        }
Ejemplo n.º 2
0
        public void Should_merge_2_suggestion_lists()
        {
            using (var context = new ApplicationDbContext(ContextOptions))
            {
                SuggestionList suggestionList = new SuggestionList(5);
                suggestionList.Add(new Suggestion(Guid.NewGuid(), 1, 5));

                SuggestionList suggestionList2 = new SuggestionList(10);
                suggestionList2.Add(new Suggestion(Guid.NewGuid(), 1, 5));
                suggestionList2.Add(new Suggestion(Guid.NewGuid(), 2, 5));

                Assert.Less(0, suggestionList2.CompareTo(suggestionList));

                SuggestionList suggestionList3 = new SuggestionList(suggestionList, suggestionList2);

                Assert.AreEqual(15, suggestionList3.TotalSum);
                Assert.AreEqual(3, suggestionList3.Count);

                Assert.DoesNotThrow(() => new SuggestionList());
            }
        }