public void SmokeTest()
        {
            var adam = new Employee { Name = "Adam", Age = 50, Salary = 125 };
            var alice = new Employee { Name = "Alice", Age = 25, Salary = 100 };
            var bob = new Employee { Name = "Bob", Age = 30, Salary = 75 };
            var carol = new Employee { Name = "Carol", Age = 35, Salary = 100 };
            var xavier = new Employee { Name = "Xavier", Age = 35, Salary = 100 };

            var employees = new List<Employee> { adam, alice, bob, carol, xavier };

            employees.Sort(OrderedComparer<Employee>.OrderBy(x => x.Name));
            Assert.True(employees.SequenceEqual(new[] { adam, alice, bob, carol, xavier }));

            employees.Sort(OrderedComparer<Employee>
                .OrderByDescending(x => x.Age)
                .ThenBy(x => x.Name)
            );
            Assert.True(employees.SequenceEqual(new[] { adam, carol, xavier, bob, alice }));

            employees.Sort(OrderedComparer<Employee>
                .OrderByDescending(x => x.Salary)
                .ThenBy(x => x.Name, StringComparer.OrdinalIgnoreCase)
            );
            Assert.True(employees.SequenceEqual(new[] { adam, alice, carol, xavier, bob }));

            employees.Sort(OrderedComparer<Employee>
                .OrderByDescending(x => x.Age)
                .ThenByDescending(x => x.Salary)
                .ThenBy(x => x.Name)
            );
            Assert.True(employees.SequenceEqual(new[] { adam, carol, xavier, bob, alice }));
        }
        /// <summary>
        /// Runs the specified test specification.
        /// </summary>
        /// <param name="specification">The test specification to run.</param>
        /// <returns>
        /// The result of running the test specification.
        /// </returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="specification"/> is <c>null</c>.</exception>
        public EventCentricAggregateFactoryTestResult Run(EventCentricAggregateFactoryTestSpecification specification)
        {
            if (specification == null) throw new ArgumentNullException("specification");
            var sut = specification.SutFactory();
            sut.Initialize(specification.Givens);
            IAggregateRootEntity factoryResult = null;
            var result = Catch.Exception(() => factoryResult = specification.When(sut));
            if (result.HasValue)
            {
                return specification.Fail(result.Value);
            }
#if NET20
            var actualEvents = new List<object>(factoryResult.GetChanges()).ToArray();
            if (!actualEvents.SequenceEqual(specification.Thens, new WrappedEventComparerEqualityComparer(_comparer)))
            {
                return specification.Fail(actualEvents);
            }
#else
            var actualEvents = factoryResult.GetChanges().ToArray();
            if (!actualEvents.SequenceEqual(specification.Thens, new WrappedEventComparerEqualityComparer(_comparer)))
            {
                return specification.Fail(actualEvents);
            }
#endif
            return specification.Pass();
        }
        public void ChainOntoRegularIComparables()
        {
            var items = new List<string> { "aaa", "AAA", "abb", "aaaa" };
            var comparer = StringComparer.OrdinalIgnoreCase;

            items.Sort(comparer);
            Assert.True(items.SequenceEqual(new[] { "AAA", "aaa", "aaaa", "abb" }, StringComparer.OrdinalIgnoreCase));

            items.Sort(comparer.ThenByDescending(x => x, StringComparer.Ordinal));
            Assert.True(items.SequenceEqual(new[] { "aaa", "AAA", "aaaa", "abb" }, StringComparer.Ordinal));
        }
Example #4
0
    static int[] FindLoop(int[] line)
    {
        for (int i = 0; i < line.Length; i++)
        {
            int nextOccurrence = Array.IndexOf(line, line[i], i + 1);

            if (nextOccurrence != -1)
            {
                List<int> testRange = new List<int>(),
                       compareRange = new List<int>();

                for (int j = i; j < nextOccurrence; j++)
                    testRange.Add(line[j]);

                for (int j = 0; j < testRange.Count; j++)
                {
                    if (j >= line.Length)
                    {
                        compareRange.Clear();
                        break;
                    }
                    compareRange.Add(line[j + nextOccurrence]);
                }
                if (testRange.SequenceEqual(compareRange))
                    return testRange.ToArray();
            }
        }
        return new int[0];
    }
Example #5
0
        public static void DoTestDescending()
        {
            List<int> numbers = new List<int> { 23, 42, 4, 16, 8, 15, 3, 9, 55, 0, 34, 12, 2, 46, 25 };
            numbers.CombSortDescending(Comparer<int>.Default);

            Debug.Assert(numbers.SequenceEqual(numbers.OrderByDescending(i => i)), "Wrong CombSort descending");
        }
Example #6
0
 bool BibTeXCheck(){
     if(!aux.ContainsKey(".aux") || aux[".aux"] == null) return false;
     var bibcite = new System.Text.RegularExpressions.Regex("\\\\bibcite\\{(.*?)\\}");
     var citation = new System.Text.RegularExpressions.Regex("\\\\citation\\{(.*?)\\}");
     var bibs = new List<string>();
     var cits = new List<string>();
     bool existbibdata = false;
     Encoding[] encs = KanjiEncoding.GuessKajiEncoding(aux[".aux"]);
     Encoding enc;
     if(encs.Length == 0) enc = Encoding.GetEncoding("shift_jis");
     else enc = encs[0];
     using(var fs = new StringReader(enc.GetString(aux[".aux"]))) {
         while(true) {
             string line = fs.ReadLine();
             if(line == null) break;
             if(!existbibdata && line.IndexOf("\\bibdata{") != -1) existbibdata = true;
             var m = bibcite.Match(line);
             if(m.Success) bibs.Add(m.Groups[1].Value);
             m = citation.Match(line);
             if(m.Success) cits.Add(m.Groups[1].Value);
         }
     }
     if(!existbibdata)return false;
     cits.Sort(); cits = new List<string>(cits.Distinct());
     bibs.Sort(); bibs = new List<string>(bibs.Distinct());
     return !(cits.SequenceEqual(bibs));
 }
Example #7
0
        /// <summary>
        /// Tests the ReplaySubject with concurrent subscribers.
        /// </summary>
        public static void ConcurrentSubscribers()
        {
            var N = int.MaxValue;
            var M = int.MaxValue;

            var r = new ReplaySubject<int>(4);

            var rnd = new Random();
            var ts = new List<Task>();

            for (var i = 0; i < 16; i++)
            {
                var rnd2 = new Random(rnd.Next());

                ts.Add(Task.Factory.StartNew(async () =>
                {
                    var n = rnd2.Next(10, 1000);

                    for (var j = 0; j < M; j++)
                    {
                        var xs = new List<int>();
                        await r.Take(n).Scan((x1, x2) =>
                        {
                            if (x2 - x1 != 1)
                                Debugger.Break();

                            if (x2 == 0)
                                Debugger.Break();

                            return x2;
                        }).ForEachAsync(xs.Add);

                        var f = xs.First();
                        if (!xs.SequenceEqual(Enumerable.Range(f, xs.Count)))
                        {
                            Console.WriteLine("FAIL!");
                            Debugger.Break();
                        }
                        else
                        {
                            Console.Write(".");
                        }

                        if (j % 1000 == 0)
                        {
                            await Task.Delay(50);
                        }
                    }
                }));
            }

            for (var i = 0; i < N; i++)
            {
                r.OnNext(i);
            }

            Console.WriteLine("Done!");

            Task.WaitAll(ts.ToArray());
        }
        public async Task Notifier_should_send_notifications_within_specified_time_span()
        {
            var minimumChecks = 3;
            var expectedEventTimeline = new List<string>();
            for (var i = 0; i < minimumChecks; ++i)
                expectedEventTimeline.AddRange(new[] { "updateHealth_start", "delay_start", "update_finish", "update_finish" });

            var countdown = new AsyncCountdown("notifications", minimumChecks);
            var endpointId = Guid.NewGuid();
            var interval = TimeSpan.FromMilliseconds(300);

            SetupHealthCheckInterval(interval);

            SetupEndpointRegistration(endpointId);

            _mockClient
                .Setup(c => c.SendHealthUpdateAsync(endpointId, AuthenticationToken, It.IsAny<HealthUpdate>(), It.IsAny<CancellationToken>()))
                .Returns(() => _awaitableFactory.Return().WithDelay(TimeSpan.FromMilliseconds(100)).WithTimeline("updateHealth").WithCountdown(countdown).RunAsync());

            _mockTimeCoordinator
                .Setup(c => c.Delay(interval, It.IsAny<CancellationToken>()))
                .Returns(() => _awaitableFactory.Return().WithDelay(TimeSpan.FromMilliseconds(50)).WithTimeline("delay").RunAsync());

            using (CreateNotifier())
                await countdown.WaitAsync(TestMaxTime);

            var actualEventTimeline = _awaitableFactory.GetOrderedTimelineEvents()
                .Select(eventName => (eventName == "updateHealth_finish" || eventName == "delay_finish") ? "update_finish" : eventName)
                .Take(minimumChecks * 4)
                .ToArray();

            Assert.True(expectedEventTimeline.SequenceEqual(actualEventTimeline), $"Expected:\n{string.Join(",", expectedEventTimeline)}\nGot:\n{string.Join(",", actualEventTimeline)}");
        }
Example #9
0
        static public bool TestCompleteSequence()
        {
            var ledRed = Light.Leds[Color.Red];
            ledRed.RunSequence();
            var ledYellow = Light.Leds[Color.Yellow];
            ledYellow.RunSequence(false);
            var ledGreen = Light.Leds[Color.Green];
            ledGreen.RunSequence(false);
            ledYellow.RunSequence(false);
            ledRed.RunSequence(false);
            var expectedSequence = new List<object>();
            expectedSequence.Add(new Tuple<Color, string>(Color.Red, "High"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Red, "3000ms"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Red, "Low"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Yellow, "High"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Yellow, "3000ms"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Yellow, "Low"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Green, "High"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Green, "3000ms"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Green, "Low"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Yellow, "High"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Yellow, "3000ms"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Yellow, "Low"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Red, "High"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Red, "3000ms"));
            expectedSequence.Add(new Tuple<Color, string>(Color.Red, "Low"));

            return (expectedSequence.SequenceEqual(Light.Sequence));
        }
Example #10
0
        public static void DoTestAscending()
        {
            List<int> numbers = new List<int> { 54, 26, 93, 17, 77, 31, 44, 55, 20 };
            numbers.GnomeSortAscending(Comparer<int>.Default);

            Debug.Assert(numbers.SequenceEqual(numbers.OrderBy(i => i)), "Wrong GnomeSort ascending");
        }
Example #11
0
        public static void DoTestDescending()
        {
            List<int> numbers = new List<int> { 84, 69, 76, 86, 94, 91, 77, 31, 44, 55, 20 };
            numbers.GnomeSortDescending(Comparer<int>.Default);

            Debug.Assert(numbers.SequenceEqual(numbers.OrderByDescending(i => i)), "Wrong GnomeSort descending");
        }
Example #12
0
        /// <summary>
        /// Devuelve una Lista de Listas de Tuplas(Doule,Doule) que contiene el historial de configuraciones de los pesos.
        /// El algoritmo tiene como condicion de Fin que se estabilicen los pesos, es decir que termina cuando la anteultima y ultima configuracion son iguales.
        /// </summary>
        /// <param name="Pesos">Lista de tuplas(double,double) que representa la configuracion de pesos iniciales.</param>
        /// <param name="Patrones">Lista de tuplas(double,double) que representa los patrones de entrada.</param>
        public List<List<Tuple<Double, Double>>> SOMAlgorithm(List<Tuple<Double, Double>> Pesos, List<Tuple<Double, Double>> Patrones)
        {
            this.HistorialActualizacion = new List<List<Tuple<Double, Double>>>();
            this.HistorialDistancias = new List<List<Double>>();
            var UltimaConfig = new List<Tuple<Double, Double>>();
            var AnteUltimaConfig = new List<Tuple<Double, Double>>();
            int i = 0;

                //foreach (var Patron in Patrones)
                do
                {
                    var Patron = Patrones[i % 5];

                    var IxGanador = FuncionActivacion(Pesos, Patron);
                    Pesos = ActualizarPesos(Pesos, Patron, Patrones.IndexOf(Patron)+1, IxGanador);

                    HistorialActualizacion.Add(Pesos);//Se guardan las configuraciones de pesos parciales. La ultima será la final.

                    //Print pesos
                    ////Console.WriteLine();
                    ////Console.WriteLine("Nuevos Pesos:");
                    //Pesos.ForEach(delegate(Tuple<Double, Double> peso) { //Console.WriteLine(peso.Item1 + "; " + peso.Item2); });
                    //Console.WriteLine();

                    i++;
                    UltimaConfig = HistorialActualizacion.Last();

                    if (i>=2)
                    {
                        AnteUltimaConfig = HistorialActualizacion.ElementAt(HistorialActualizacion.IndexOf(UltimaConfig)-1) ;
                    }

                } while (!UltimaConfig.SequenceEqual(AnteUltimaConfig));
            return HistorialActualizacion;
        }
        public void CustomComparerTest()
        {
            var items = new List<string> { "aaa", "AAA", "abb", "aaaa" };

            items.Sort(OrderedComparer<string>.OrderBy(x => x, StringComparer.Ordinal));
            Assert.True(items.SequenceEqual(new[] { "AAA", "aaa", "aaaa", "abb" }));

            items.Sort(OrderedComparer<string>.OrderByDescending(x => x.Length).ThenBy(x => x, StringComparer.Ordinal));
            Assert.True(items.SequenceEqual(new[] { "aaaa", "AAA", "aaa", "abb" }));

            items.Sort(OrderedComparer<string>.OrderBy(x => x.Length).ThenBy(x => x, StringComparer.Ordinal));
            Assert.True(items.SequenceEqual(new[] { "AAA", "aaa", "abb", "aaaa" }));

            items.Sort(OrderedComparer<string>.OrderBy(x => x.Length).ThenBy(x => x, StringComparer.OrdinalIgnoreCase));
            Assert.True(items.SequenceEqual(new[] { "AAA", "AAA", "abb", "aaaa" }, StringComparer.OrdinalIgnoreCase));
        }
Example #14
0
        /// <summary>
        /// Tests the Replay operator with different schedulers, supporting ISchedulerLongRunning and otherwise.
        /// Stresses the ScheduledObserver implementation with its counting logic.
        /// </summary>
        public static void DifferentSchedulers()
        {
            while (true)
            {
                for (int i = 100; i <= 10000; i *= 10)
                {
                    foreach (var s in new IScheduler[] { Scheduler.Default, TaskPoolScheduler.Default, ThreadPoolScheduler.Instance })
                    {
                        foreach (var b in new[] { true, false })
                        {
                            var t = b ? s : s.DisableOptimizations();

                            var e = new ManualResetEvent(false);
                            var xs = Observable.Range(0, i, TaskPoolScheduler.Default.DisableOptimizations()).Do(_ => { }, () => e.Set());

                            var ys = xs.Replay(t);

                            var f = new ManualResetEvent(false);
                            var r = new List<int>();
                            ys.Subscribe(r.Add, () => f.Set());

                            ys.Connect();
                            
                            e.WaitOne();
                            f.WaitOne();

                            if (!r.SequenceEqual(Enumerable.Range(0, i)))
                                throw new Exception();

                            Console.Write(".");
                        }
                    }
                }
            }
        }
Example #15
0
        public static void DoTestDescending()
        {
            List<int> numbers = new List<int> { 23, 42, 4, 16, 8, 15, 3, 9, 55, 0, 34, 12, 2, 46, 25 };
            numbers.PigeonHoleSortDescending();

            Debug.Assert(numbers.SequenceEqual(numbers.OrderByDescending(i => i)), "Wrong PigeonHole descending");
        }
Example #16
0
        public static void TestInvoker()
        {
            var range = Arrays.Range(0, 1, 100);
            var list = new List<int>();
            IAsyncResult result = null;

            using (var sti = new SingleThreadedInvoker())
            {
                foreach (int i in range)
                {
                    int j = i;
                    if (j % 2 == 0)
                        result = sti.BeginInvoke(new Action(() =>
                        {
                            list.Add(j);
                        }), new object[0]);
                    else
                        sti.Invoke(new Action(() =>
                        {
                            list.Add(j);
                        }), new object[0]);
                }

                // wait for all to finish
                sti.EndInvoke(result);
            }

            if (!list.SequenceEqual(range))
                throw new Exception("SingleThreadedInvoker failed!");
        }
        public void BindTo_should_set_list_of_items()
        {
            var items = new List<string> { "1", "2", "3"};

            builder.BindTo(items);

            Assert.True(items.SequenceEqual(AutoComplete.Items));
        }
Example #18
0
        public void ShouldReturnInnerElements()
        {
            var innerList = new List<int> { 1, 2, 3 };

            var list = new LazyList<int>(() => innerList);

            Assert.True(innerList.SequenceEqual(list));
        }
 public static void Can_get_ThisKeyMembers_and_OtherKeyMembers()
 {
     var listOfThisKeys = new List<string>() { "ThisKey1", "ThisKey2", "ThisKey3" };
     var listOfOtherKeys = new List<string>() { "OtherKey1", "OtherKey2" };
     // doesn't matter how many spaces are between keys, but they must be separated by a comma
     var attribute = new AssociationAttribute("Name", "ThisKey1,  ThisKey2, ThisKey3", "OtherKey1,  OtherKey2");
     Assert.True(listOfThisKeys.SequenceEqual(attribute.ThisKeyMembers));
     Assert.True(listOfOtherKeys.SequenceEqual(attribute.OtherKeyMembers));
 }
Example #20
0
        public static void MemberNames_can_be_set_through_two_args_constructor()
        {
            var validationResult = new ValidationResult("SomeErrorMessage", null);
            AssertEx.Empty(validationResult.MemberNames);

            var memberNames = new List<string>() { "firstMember", "secondMember" };
            validationResult = new ValidationResult("SomeErrorMessage", memberNames);
            Assert.True(memberNames.SequenceEqual(validationResult.MemberNames));
        }
Example #21
0
        public void Explicit_List_Cast()
        {
            //arrange
            List<int> expected = new List<int>() { 1, 2, 3 };
            SetType<IntegerType> actualType = SetType<IntegerType>.From(expected);

            //act
            CassandraObject actual = actualType;
            var actualValues = actual.GetValue<List<object>>();

            //assert
            Assert.True(expected.SequenceEqual(actualValues.Select(Convert.ToInt32)));
        }
        public void Create_NullCoalescingAction()
        {
            var xs = Observable.Create<int>(o =>
            {
                o.OnNext(42);
                return default(Action);
            });

            var lst = new List<int>();
            var d = xs.Subscribe(lst.Add);
            d.Dispose();

            Assert.IsTrue(lst.SequenceEqual(new[] {42}));
        }
Example #23
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            var username = "";
            var password = "";
            var list = new List<string>();
            DA.GetDataList(0, list);
            DA.GetData(1, ref username);
            DA.GetData(2, ref password);


            if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password))
            {
                BimServer.Username = username;
                BimServer.Password = password;
            }


            if (list.SequenceEqual(BimVisualiserData.Instance.URIList))
            {
                BimVisualiserData.Instance.URIList = list;
            }
            // New data feeded, need to recompute
            else
            {
                _returnValue = "";
                BimVisualiserData.Instance.Selected = -1;
                BimVisualiserData.Instance.URIList = list;
                BimVisualiserData.Instance.NameList = new List<string>();
            }


            if (BimVisualiserData.Instance.NameList.Count == 0)
            {
                foreach (var uri in BimVisualiserData.Instance.URIList)
                {
                    var client = new BimServer();
                    client.Login();
                    var name = GetProjectName(client, uri);
                    BimVisualiserData.Instance.NameList.Add(name);
                }

                m_attributes.ExpireLayout();
            }


            DA.SetData(0, _returnValue);
        }
        public void AddShouldInsertNewItem()
        {
            // arrange
            var expectedProperties = new[] { "Count", "Item[]" };
            var actualProperties = new List<string>();
            var target = new ObservableKeyedCollection<string, int>( i => i.ToString() );

            target.PropertyChanged += ( s, e ) => actualProperties.Add( e.PropertyName );

            // act
            target.Add( 1 );

            // assert
            Assert.Equal( 1, target.Count );
            Assert.Equal( 1, target[0] );
            Assert.True( actualProperties.SequenceEqual( expectedProperties ) );
        }
        public void Should_be_able_to_enumerate_keys()
        {
            // Given
            dynamic parameters = new DynamicDictionary();

            parameters["test"] = "10";
            parameters["rest"] = "20";

            // When
            var names = new List<string>();
            foreach (var name in parameters) {
                names.Add(name);
            }

            // Then
            Assert.True(names.SequenceEqual(new[] { "test", "rest" }));
        }
        public void ShouldUnselectValueInCollectionOnClear()
        {
            // arrange
            var target = new SelectableItemCollection<string>( new[] { "1", "2", "3" } );
            var expectedProperties = new[] { "Count", "Item[]" };
            var actualProperties = new List<string>();

            target.SelectedValues.Add( "2" );
            ( (INotifyPropertyChanged) target.SelectedValues ).PropertyChanged += ( s, e ) => actualProperties.Add( e.PropertyName );

            // act
            target.SelectedValues.Clear();

            // assert
            Assert.Equal( 0, target.SelectedItems.Count );
            Assert.True( actualProperties.SequenceEqual( expectedProperties ) );
        }
        public void GetAllReturnsAllStrategies()
        {
            // Arrange:
            var cooperationStrategyRepository = new CooperationStrategyRepository();

            // Act:
            var strategies = cooperationStrategyRepository.GetAll();

            // Assert
            var allStrategies = new List<CooperationStrategy>
                                    {
                                        new NaiveCooperationStrategy(),
                                        new EvilCooperationStrategy(),
                                        new TitForTatCooperationStrategy(),
                                    };
            Assert.True(allStrategies.SequenceEqual(strategies));
        }
Example #28
0
        public static SyntaxTokenList Organize(SyntaxTokenList modifiers)
        {
            if (modifiers.Count > 1 && !modifiers.SpansPreprocessorDirective())
            {
                var initialList = new List<SyntaxToken>(modifiers);
                var leadingTrivia = initialList.First().LeadingTrivia;
                initialList[0] = initialList[0].WithLeadingTrivia(SpecializedCollections.EmptyEnumerable<SyntaxTrivia>());

                var finalList = initialList.OrderBy(new Comparer()).ToList();
                if (!initialList.SequenceEqual(finalList))
                {
                    finalList[0] = finalList[0].WithLeadingTrivia(leadingTrivia);

                    return finalList.ToSyntaxTokenList();
                }
            }

            return modifiers;
        }
Example #29
0
        static void Main()
        {
            var list = new List<string>();

            while (true)
            {
                var _ = new List<string>();
                var url = new List<string>();

                var xmlReader = XmlReader.Create("http://rssblog.ameba.jp/asakuramomoblog/rss20.xml");
                while (xmlReader.Read())
                {
                    if (xmlReader.NodeType != XmlNodeType.Element) continue;
                    switch (xmlReader.LocalName)
                    {
                        case "title":
                            _.Add(xmlReader.ReadString());
                            break;
                        case "link":
                            url.Add(xmlReader.ReadString());
                            break;
                    }
                }

                if (!list.SequenceEqual(_))
                {
                    if (list.Count != 0)
                    {
                        var sw = new System.IO.StreamWriter("mocho.log", false, Encoding.UTF8);
                        sw.Write("麻倉ももオフィシャルブログ「もちょっとおしゃべり」が更新されました!\n『" + _[1] + "』" + url[4]);
                        sw.Close();

                        Process.Start(new ProcessStartInfo("python", "./tw.py"));
                    }
                }
                list.Clear();
                list.AddRange(_);

                Console.WriteLine(string.Join("\n", list) + "\n");

                Thread.Sleep(10 * 60 * 1000);
            }
        }
Example #30
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter a series of numbers separated by a hyphen");
            var numbers = Console.ReadLine();
            var numbersList = new List<int>();
            numbersList = numbers.Split('-').Select(Int32.Parse).ToList();
            var sortedNumbers = new List<int>(numbersList);
            sortedNumbers.Sort();

            if (numbersList.SequenceEqual(sortedNumbers))
            {
                Console.WriteLine("Consecutive");
            }
            else
            {
                Console.WriteLine("Not consecutive");
            }
            Console.ReadKey();
        }