public void Calculate_When1DiscountAppliesMoreThanOnceAndThereAreAdditionalDiscountableItems_ReturnsCorrectCost()
        {
            const decimal expected = 1m;
            var products = new List<Product>
            {
                new Product {Id = 1, Name = "Butter", UnitPrice = 0.80m},
                new Product {Id = 1, Name = "Butter", UnitPrice = 0.80m},
                new Product {Id = 1, Name = "Butter", UnitPrice = 0.80m},
                new Product {Id = 1, Name = "Butter", UnitPrice = 0.80m},
                new Product {Id = 3, Name = "Bread", UnitPrice = 1.00m},
                new Product {Id = 3, Name = "Bread", UnitPrice = 1.00m},
                new Product {Id = 3, Name = "Bread", UnitPrice = 1.00m},
                new Product {Id = 3, Name = "Bread", UnitPrice = 1.00m},
                new Product {Id = 3, Name = "Bread", UnitPrice = 1.00m},
                new Product {Id = 3, Name = "Bread", UnitPrice = 1.00m},
                new Product {Id = 3, Name = "Bread", UnitPrice = 1.00m},
                new Product {Id = 3, Name = "Bread", UnitPrice = 1.00m}
            };

            _discountOfferRepositoryMock.Setup(m => m.GetDiscountOffers()).Returns(new List<DiscountOffer>
                {
                    new DiscountOffer { ProductBoughtId = 1, NumberToBuy = 2, ProductDiscountedId = 3, PercentageOff = 0.5m }
                });

            var actual = _discountOfferCalculatorService.Calculate(products);

            Assert.That(actual, Is.EqualTo(expected));
            Assert.That(products.Count(p => p.Name == "Bread" && p.Processed) == 2);
            Assert.That(products.Count(p => p.Name == "Bread" && p.Processed == false) == 6);
            Assert.That(products.Where(p => p.Name == "Butter").All(p => p.Processed == false));
        }
Esempio n. 2
0
        public void FiltersDataOutsideRTHWhenSessionSpansMultipleDays()
        {
            var sessions = new List<InstrumentSession>
            {
                new InstrumentSession
                { 
                    OpeningDay = DayOfTheWeek.Monday ,
                    ClosingDay = DayOfTheWeek.Tuesday,
                    OpeningTime = new TimeSpan(8, 0, 0),
                    ClosingTime = new TimeSpan(16, 0, 0),
                    IsSessionEnd = true
                }
            };

            var data = GetDataBetween(new DateTime(2014, 1, 13, 0, 0, 0), new DateTime(2014, 1, 14, 23, 0, 0));
            var unfilteredData = new List<OHLCBar>(data);

            RTHFilter.Filter(data, sessions);

            var startCutoff = new DateTime(2014, 1, 13, 8, 0, 0);
            var endingCutoff = new DateTime(2014, 1, 14, 16, 0, 0);

            Assert.AreEqual(0, data.Count(x => x.DT < startCutoff));
            Assert.AreEqual(0, data.Count(x => x.DT > endingCutoff));
            Assert.AreEqual(
                unfilteredData.Count 
                - unfilteredData.Count(x => x.DT <= startCutoff) 
                - unfilteredData.Count(x => x.DT > endingCutoff), 
                data.Count);
        }
        public void TestRandomSelectLessThanNumberOfSelections()
        {
            IEnumerable<object> enumerable = new List<object> { new object(), new object() };
            Assert.AreEqual(enumerable, enumerable.RandomSelect(enumerable.Count() + 1));

            IList<object> selectedItems = new List<object>();
            enumerable.RandomSelect(enumerable.Count() + 1, selectedItems.Add);
            Assert.IsTrue(CollectionUtils.SequenceEqual(enumerable, selectedItems));
        }
Esempio n. 4
0
        public void RemoveNoneTest()
        {
            var original = new int[] { 1, 2, 3, 4, 5, 6 };
            var l = new List<int>(original);

            Assert.AreEqual(original.Length, l.Count());
            l.RemoveDuplicates((x, y) => x == y);

            Assert.AreEqual(original.Length, l.Count());
        }
        public void RandomShufflerHandleNullAbleList()
        {
            const int expectedNumOfNull = 3;
            const int expectedNumOfOne = 1;

            var list = new List<int?>() { null, null, 1, null};
            ListRandomShuffler.InPlaceShuffle(list);

            var numOfNull = list.Count(i => i == null);
            var numOfOne = list.Count(i => i == 1);
            Assert.AreEqual(numOfNull, expectedNumOfNull);
            Assert.AreEqual(numOfOne, expectedNumOfOne);
        }
        public void RandomShufflerHandleNullAbleRefferenceTypeList()
        {
            const int expectedNumOfNull = 3;
            const int expectedNumOfStr = 1;
            const string str = "This is not null";

            var list = new List<string>() { null, null, str, null };
            ListRandomShuffler.InPlaceShuffle(list);

            var numOfNull = list.Count(i => i == null);
            var numOfStr = list.Count(i => i == str);
            Assert.AreEqual(numOfNull, expectedNumOfNull);
            Assert.AreEqual(numOfStr, expectedNumOfStr);
        }
        public void InspectObject_With_CircularReference()
        {
            var parent = new ClassWithCircularReference_Parent();
            parent.Child = new ClassWithCircularReference_Child();
            parent.Child.Parent = parent;
            var itensFounded = new List<object>();

            _objectInspector.InspectObject(parent, value =>
            {
                itensFounded.Add(value);
            });

            Assert.AreEqual(1, itensFounded.Count(p => p.Equals(parent)), "Deveria ter achado o objeto parent apenas uma vez");
            Assert.AreEqual(1, itensFounded.Count(p => p.Equals(parent.Child)), "Deveria ter achado o objeto parent.Child apenas uma vez");
        }
Esempio n. 8
0
        public void Buffer_CursorTop_Test()
        {
            var process = new Process { StartInfo = { FileName = "cmd.exe" } };
            process.Start();

            AttachConsole(process.Id);
            var buffer = JConsole.GetActiveScreenBuffer();

            Assert.That(buffer.CursorTop, Is.EqualTo(3));
            Assert.That(buffer.CursorLeft, Is.GreaterThan(0));

            var events = new List<EventArgs>();
            events.Add(new ConsoleKeyEventArgs { KeyDown = true, RepeatCount = 1, KeyChar = 'd' });
            events.Add(new ConsoleKeyEventArgs { KeyDown = false, RepeatCount = 1, KeyChar = 'd' });
            events.Add(new ConsoleKeyEventArgs { KeyDown = true, RepeatCount = 1, KeyChar = 'i' });
            events.Add(new ConsoleKeyEventArgs { KeyDown = false, RepeatCount = 1, KeyChar = 'i' });
            events.Add(new ConsoleKeyEventArgs { KeyDown = true, RepeatCount = 1, KeyChar = 'r' });
            events.Add(new ConsoleKeyEventArgs { KeyDown = false, RepeatCount = 1, KeyChar = 'r' });
            events.Add(new ConsoleKeyEventArgs { KeyDown = true, RepeatCount = 1, KeyChar = (char)13 });
            events.Add(new ConsoleKeyEventArgs { KeyDown = false, RepeatCount = 1, KeyChar = (char)13 });

            var inputBuffer = JConsole.GetInputBuffer();
            inputBuffer.WindowInput = true;
            inputBuffer.WriteEvents(events, events.Count());

            buffer.WriteLine(buffer.OutputMode.ToString());
        }
Esempio n. 9
0
 public void PrintEmailsGroupedByDomain()
 {
     List<string> emails = new List<string> { "*****@*****.**", "*****@*****.**", "*****@*****.**" };
     Dictionary<string, List<string>> groups = new Dictionary<string, List<string>>();
     for (int i = 0; i < emails.Count(); i++)
     {
         Match split = Regex.Matches(emails[i], @"[^@]*@(.*)")[0];
         string domain = split.Groups[1].Value;
         if (!groups.ContainsKey(domain))
         {
             groups.Add(domain, new List<string> { emails[i] });
         }
         else
         {
             groups[domain].Add(emails[i]);
         }
     }
     foreach (var key in groups.Keys)
     {
         Console.WriteLine("Emails for domain: " + key);
         for (int i = 0; i < groups[key].Count; i++)
         {
             Console.WriteLine(groups[key][i]);
         }
         Console.WriteLine();
     }
 }
 public void Given_EmptyList_When_RandomX_ReturnEmptyList()
 {
     var l = new List<string>();
     IEnumerable<string> rand = new List<string>();
     Assert.DoesNotThrow(() => rand = l.GetRandomX(4));
     Assert.AreEqual(0, rand.Count());
 }
        public void D_visit_complete_tree_depthFirst_on_VisitDescendants()
        {
            // ACT

            var result = new List<Tuple<List<string>, string>>();
            "rootNode".VisitDescendants(this.GetChildNodes, (b, n) => result.Add(Tuple.Create(b.ToList(), n)), depthFirst: true);

            // ASSERT

            Assert.AreEqual(5, result.Count());
            CollectionAssert.AreEqual(new[] {
                "leftNode",
                "leftLeaf",
                "rightNode",
                "leftRightLeaf",
                "rightRightLeaf"
            }, result.Select(i => i.Item2));

            CollectionAssert.AreEqual(new[] { "leftNode", "leftLeaf", "rightNode", "leftRightLeaf", "rightRightLeaf" }, result.Select(i => i.Item2));
            CollectionAssert.AreEqual(new[] { "rootNode" }, result.ElementAt(0).Item1);
            CollectionAssert.AreEqual(new[] { "rootNode", "leftNode" }, result.ElementAt(1).Item1);
            CollectionAssert.AreEqual(new[] { "rootNode" }, result.ElementAt(2).Item1);
            CollectionAssert.AreEqual(new[] { "rootNode", "rightNode" }, result.ElementAt(3).Item1);
            CollectionAssert.AreEqual(new[] { "rootNode", "rightNode" }, result.ElementAt(4).Item1);
        }
        public void TestBolsterAllies()
        {
            Start game = new Start();
            game.beginGame();
            Legacy legacy = new Legacy();

            List<int> firstList = new List<int>();
            foreach (Hero hero in GameEngine.getHeroes())
            {
                firstList.Add(hero.hand.Count());
            }

            Card bolster = new Card("Images\\Hero\\Legacy\\BolsterAllies.png");
            legacy.BolsterAllies(bolster);

            List<int> secondList = new List<int>();
            foreach (Hero hero in GameEngine.getHeroes())
            {
                secondList.Add(hero.hand.Count());
            }

            for(int i = 0; i < secondList.Count(); i++)
            {
                Assert.AreEqual(secondList[i], firstList[i] + 1);
            }
        }
        public void UsingWebRequest()
        {
            var count = 0;
            var requestUri = new Uri("http://google.com");

            var sp = Stopwatch.StartNew();
            var tasks = new List<Task>();
            for (var i = 0; i < 10; i++)
            {
                var t = Task.Run(() =>
                {
                    var webRequest = WebRequest.Create(requestUri);
                    webRequest.GetResponse().Close();
                    Interlocked.Increment(ref count);
                });
                tasks.Add(t);
            }
            var whenAll = Task.WhenAll(tasks);
            while (whenAll.IsCompleted == false && whenAll.IsFaulted  == false)
            {
                Thread.Sleep(1000);
                Console.WriteLine("{0} - {1}, {2}", sp.Elapsed, count, tasks.Count(x=> x.IsCompleted == false));
            }
            Console.WriteLine(sp.Elapsed);
        }
        public void TestSmaSimple()
        {
            int period = 5;

            List<double> data = new List<double>(new double[]{
                3,
                3,
                3,
                3,
                3
            });

            var result =  TechnicalAnalisysMethods.SimpleMovingAverage(data);

            int zeroCnt = result.Where(x => x == 0.0).Count();
            int valueCnt = result.Length - zeroCnt;

            Assert.That(result.Length == data.Count());

            Assert.That(zeroCnt == 4);

            double sma = result.Where(x => x != 0.0).First();

            Assert.That(sma == 3.0);
        }
Esempio n. 15
0
 public void PrintEmailsGroupedByDomain_ExtractLocalVariablesResharper()
 {
     var emails = new List<string> { "*****@*****.**", "*****@*****.**", "*****@*****.**" };
     var groups = new Dictionary<string, List<string>>();
     for (var i = 0; i < emails.Count(); i++)
     {
         var email = emails[i];
         var split = Regex.Matches(email, @"[^@]*@(.*)")[0];
         var domain = split.Groups[1].Value;
         if (!groups.ContainsKey(domain))
         {
             groups.Add(domain, new List<string> { email });
         }
         else
         {
             groups[domain].Add(email);
         }
     }
     foreach (var key in groups.Keys)
     {
         Console.WriteLine("Emails for domain: " + key);
         var emailsInDomain = groups[key];
         for (var i = 0; i < emailsInDomain.Count; i++)
         {
             Console.WriteLine(emailsInDomain[i]);
         }
         Console.WriteLine();
     }
 }
Esempio n. 16
0
 public static void AreEqual(List<TimeScope> timescopes, List<TIM> tims)
 {
     for (var i = 0; i < timescopes.Count(); i++)
     {
         AreEqual(timescopes[i], tims[i]);
     }
 }
Esempio n. 17
0
        public void TestCreateSrcMLArchiveFtF() {
            using (Archive srcmlArchive = new Archive(), srcmlArchive2 = new Archive()) {
                using (Unit srcmlUnit = new Unit()) {
                    srcmlUnit.SetUnitFilename(Path.Combine(TestInputPath, "input.cpp"));
                    srcmlArchive.SetArchiveLanguage(LibSrcMLRunner.SrcMLLanguages.SRCML_LANGUAGE_CXX);
                    srcmlArchive.AddUnit(srcmlUnit);
                    srcmlArchive.SetOutputFile("output");
                    srcmlArchive.ArchivePack();

                    srcmlUnit.SetUnitFilename(Path.Combine(TestInputPath, "input2.cpp"));
                    srcmlArchive2.SetArchiveLanguage(LibSrcMLRunner.SrcMLLanguages.SRCML_LANGUAGE_CXX);
                    srcmlArchive2.AddUnit(srcmlUnit);
                    srcmlArchive2.SetOutputFile("output");

                    srcmlArchive2.ArchivePack();

                    IntPtr structPtr = srcmlArchive.GetPtrToStruct();
                    IntPtr structPtr2 = srcmlArchive2.GetPtrToStruct();

                    List<IntPtr> structArrayPtr = new List<IntPtr>();
                    structArrayPtr.Add(structPtr);
                    structArrayPtr.Add(structPtr2);

                    try {
                        Assert.True(LibSrcMLRunner.SrcmlCreateArchiveFtF(structArrayPtr.ToArray(), structArrayPtr.Count()) == IntPtr.Zero);
                    }
                    catch (SrcMLException e) {
                        Console.WriteLine(e.Message);
                    }
                }
                {
                    Assert.True(File.Exists("output0.cpp.xml"));
                    SrcMLFile srcFile = new SrcMLFile("output0.cpp.xml");
                    Assert.IsNotNull(srcFile);

                    var files = srcFile.FileUnits.ToList();
                    Assert.AreEqual(1, files.Count());

                    string file = Path.Combine(TestInputPath, "input.cpp");
                    var f1 = (from ele in files
                              where ele.Attribute("filename").Value == file
                              select ele);
                    Assert.AreEqual(file, f1.FirstOrDefault().Attribute("filename").Value);
                }
                {
                    Assert.True(File.Exists("output1.cpp.xml"));
                    SrcMLFile srcFile = new SrcMLFile("output1.cpp.xml");
                    Assert.IsNotNull(srcFile);

                    var files = srcFile.FileUnits.ToList();
                    Assert.AreEqual(1, files.Count());

                    string file1 = Path.Combine(TestInputPath, "input2.cpp");
                    var f2 = (from ele in files
                              where ele.Attribute("filename").Value == file1
                              select ele);
                    Assert.AreEqual(file1, f2.FirstOrDefault().Attribute("filename").Value);
                }
            }
        }
        public void TestSmaComplex()
        {
            int period = 5;

            List<double> data = new List<double>(new double[]{
                3,
                4,
                5,
                6,
                7,
                8,
                9,
                10
            });

            var result = TechnicalAnalisysMethods.SimpleMovingAverage(data);

            Console.WriteLine(result.ToArray().ToString());

            int zeroCnt = result.Where(x => x == 0.0).Count();
            int valueCnt = result.Length - zeroCnt;

            Assert.That(result.Length == data.Count());

            Assert.That(zeroCnt == 4);

            Assert.That(result[7] == 8.0);

            Assert.That(result[6] == 7.0);
        }
        private void AssertCreatedEnvironment(DeployEnvironment result, DeployProject project, string environmentName, List<DeployEnvironmentConfiguration> environmentComponentList, List<DeployEnvironmentConfiguration> environmentConfigurationList, IProjectRepository sut)
        {
            Assert.IsNotNull(result);
            Assert.IsNotNullOrEmpty(result.Id);
            Assert.AreEqual(project.Id, result.ProjectId);
            Assert.AreEqual(environmentName, result.EnvironmentName);
            AssertHelpers.AssertCreatedBaseDto(result, this.UserName);
            
            environmentComponentList = environmentComponentList ?? new List<DeployEnvironmentConfiguration>();
            Assert.AreEqual(environmentComponentList.Count(), result.ComponentList.Count);
            foreach(var item in environmentComponentList)
            {
                var createdItem = result.ComponentList.SingleOrDefault(i=>i.ParentId == item.ParentId);
                AssertCreatedEnvironmentConfiguration(item, createdItem, project, result, EnumDeployStepParentType.Component);
            }
            environmentConfigurationList = environmentConfigurationList ?? new List<DeployEnvironmentConfiguration>();
            Assert.AreEqual(environmentConfigurationList.Count(), result.ConfigurationList.Count);
            foreach (var item in environmentConfigurationList)
            {
                var createdItem = result.ConfigurationList.SingleOrDefault(i => i.ParentId == item.ParentId);
                AssertCreatedEnvironmentConfiguration(item, createdItem, project, result, EnumDeployStepParentType.Configuration);
            }

            var dbItem = sut.GetEnvironment(result.Id, result.ProjectId);
            AssertEnvironment(result, dbItem);

            var dbProject = sut.GetProject(project.Id);
            var dbProjectEnvironment = dbProject.EnvironmentList.SingleOrDefault(i => i.Id == result.Id);
            Assert.IsNotNull(dbProjectEnvironment);
            AssertEnvironment(result, dbProjectEnvironment);
        }
        public void TestAllPossibleFourOfAKindHands()
        {
            IList<ICard> fourOfAKindCollection = new List<ICard>();
            byte countOfAllValues = 13;
            byte countOfAllKinds = 4;
            Hand playerHand;
            List<bool> results = new List<bool>();
            int faceOfAdditionalCard;

            for (int i = 0; i < countOfAllValues; i++)
            {
                faceOfAdditionalCard = i;

                for (int j = 1; j <= countOfAllKinds; j++)
                {
                    fourOfAKindCollection.Add(new Card((CardFace)i + 2, (CardSuit)j));
                }

                if (faceOfAdditionalCard + 3 > 14)
                {
                    faceOfAdditionalCard = 2;
                }

                fourOfAKindCollection.Add(new Card((CardFace)faceOfAdditionalCard + 3, CardSuit.Hearts));
                playerHand = new Hand(fourOfAKindCollection);

                results.Add(this.checker.IsFourOfAKind(playerHand));

                fourOfAKindCollection.Clear();
            }

            byte countOfAllTrueResults = (byte)results.Count(res => res == true);

            Assert.AreEqual(results.Count, countOfAllTrueResults);
        }
Esempio n. 21
0
        public void Iter()
        {
            int[] i = new[] { 10, 4, 16, 1 };
            List<int> i2 = new List<int>();

            i.Iter(j => i2.Add(j));
            Assert.AreEqual(0, i2.Count());

            i.Iter(j => i2.Add(j)).ToArray();
            Assert.AreEqual(i.Length, i2.Count());

            for (int k = 0; k < 4; k++)
            {
                Assert.AreEqual(i[k], i2[k]);
            }
        }
Esempio n. 22
0
 public static void AreEqual(XmlNodeList cropVarietyNodes, List<CropVariety> cropVarieties, Dictionary<string, List<UniqueId>> linkList)
 {
     for (var i = 0; i < cropVarieties.Count(); ++i)
     {
         AreEqual(cropVarietyNodes[i], cropVarieties[i], linkList);
     }
 }
Esempio n. 23
0
        public async void RemoveTest1()
        {
            string entryMessage1 = "entry 1";
            AddMongoEntryAsyncDelegate(entryMessage1, MONGO_COLLECTION_1_NAME);
            string entryMessage2 = "entry 2";
            AddMongoEntryAsyncDelegate(entryMessage2, MONGO_COLLECTION_1_NAME);

            List<Entry> results = new List<Entry>(_readerT.Read(MONGO_COLLECTION_1_NAME, "TimeStamp", _beforeTest, DateTime.Now));
            Assert.AreEqual(2, results.Count());
            Assert.AreEqual(entryMessage1, results[0].Message);
            Assert.AreEqual(entryMessage2, results[1].Message);

            var searchQuery = Query.NE("Message", entryMessage1);

            // remove entries with Message != entryMessage1
            WriteConcernResult writeConcernResult = await _asyncUpdaterT.RemoveAsync(MONGO_COLLECTION_1_NAME, searchQuery);
            Assert.IsFalse(writeConcernResult.UpdatedExisting);
            Assert.IsFalse(writeConcernResult.HasLastErrorMessage);
            Assert.IsNull(writeConcernResult.LastErrorMessage);
            Assert.IsNull(writeConcernResult.Upserted);
            Assert.AreEqual(1, writeConcernResult.DocumentsAffected);

            results = new List<Entry>(_readerT.Read(MONGO_COLLECTION_1_NAME, "TimeStamp", _beforeTest, DateTime.Now));
            Assert.AreEqual(1, results.Count());
            Assert.AreEqual(entryMessage1, results[0].Message);
        }
        public void FindAndModifyTest1()
        {
            string entryMessage1 = "entry 1";
            AddMongoEntry(entryMessage1, MONGO_COLLECTION_1_NAME);

            List<Entry> results = new List<Entry>(_readerT.Read(MONGO_COLLECTION_1_NAME, "TimeStamp", _beforeTest, DateTime.Now));
            Assert.AreEqual(1, results.Count());
            Assert.AreEqual(entryMessage1, results[0].Message);

            var searchQuery = Query.EQ("Message", entryMessage1);

            var update = Update.Set("Message", MONGO_EDITED_TEXT);
            var sortBy = SortBy.Descending("TimeStamp");

            FindAndModifyArgs findAndModifyArgs = new FindAndModifyArgs();
            findAndModifyArgs.Query = searchQuery;
            findAndModifyArgs.SortBy = sortBy;
            findAndModifyArgs.Update = update;
            findAndModifyArgs.Upsert = true;
            findAndModifyArgs.VersionReturned = FindAndModifyDocumentVersion.Modified;

            _AsyncDelegateUpdaterT.FindAndModifyAsync(MONGO_COLLECTION_1_NAME, findAndModifyArgs);
            _updaterAutoResetEvent.WaitOne();

            Assert.IsTrue(_findAndModifyResult.Ok, "FindAndModifyResult from FindAndModify not OK");
            Assert.IsNull(_findAndModifyResult.ErrorMessage);
            Assert.IsNotNull(_findAndModifyResult.ModifiedDocument);

            results = new List<Entry>(_readerT.Read(MONGO_COLLECTION_1_NAME, "TimeStamp", _beforeTest, DateTime.Now));
            Assert.AreEqual(1, results.Count());
            Assert.AreEqual(MONGO_EDITED_TEXT, results[0].Message);/*This field we modified via FindAndModify...*/
        }
 public void can_detect_a_public_instance_constructor()
 {
     var list = new List<MemberReference>();
     var def = assembly.GetTypeDefinition<TestType>();
     def.GetPublicsAndProtectedsFromType(list);
     Assert.That(list.Count(x => x.FullName == "System.Void AutoTest.Minimizer.Tests.TestType::.ctor(System.Int32)") == 1);
 }
 public void can_detect_a_public_static_method()
 {
     var list = new List<MemberReference>();
     var def = assembly.GetTypeDefinition<TestType>();
     def.GetPublicsAndProtectedsFromType(list);
     Assert.That(list.Count(x => x.FullName == "System.Int32 AutoTest.Minimizer.Tests.TestType::staticpublicmethod()") == 1);
 }
Esempio n. 27
0
 public void can_shift()
 {
     var ints = new List<int> {1, 2, 3, 4};
     var x = ints.Shift();
     x.ShouldEqual(1);
     ints.Count().ShouldEqual(3);
     ints.First().ShouldEqual(2);
 }
Esempio n. 28
0
 private static void VerifySortedOrder(List<FileVersion> list)
 {
     for (int i = 0; i < list.Count() - 1; ++i)
     {
         var f1 = list[i];
         var f2 = list[i + 1];
         Assert.IsTrue(f1 >= f2);
     }
 }
Esempio n. 29
0
 public void IsNodeLibrary_IsFalseAndHasMessagesForBadlyFormatted()
 {
     IList<ILogMessage> ws = new List<ILogMessage>();
     Assert.False(Package.IsNodeLibrary(new List<string>
     {
         "\\ x x x x x x"
     }, assemName, ref ws));
     Assert.AreEqual(2, ws.Count());
 }
        public void Clear_non_empty_queue()
        {
            var queue = new List<PriorityQueue<string>.Element> {new PriorityQueue<string>.Element("a", 1)};
            var sut = new PriorityQueue<string>(queue);

            sut.Clear();

            Assert.AreEqual(0, queue.Count());
        }