NUnit.Framework.Assert.Less(System.IComparable, System.IComparable)

Here are the examples of the csharp api class NUnit.Framework.Assert.Less(System.IComparable, System.IComparable) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

151 Examples 7

1. Example

Project: ContinuousTests
Source File: LessFixture.cs
View license
[Test, ExpectedException( typeof( AssertionException ))]
		public void NotLessIComparable()
		{
			expectedMessage =
				"  Expected: less than StoredProcedure" + Environment.NewLine +
				"  But was:  TableDirect" + Environment.NewLine;
			Assert.Less(e2,e1);
		}

2. Example

Project: ContinuousTests
Source File: LessFixture.cs
View license
[Test, ExpectedException( typeof( AssertionException ))]
		public void NotLessIComparable()
		{
			expectedMessage =
				"  Expected: less than StoredProcedure" + Environment.NewLine +
				"  But was:  TableDirect" + Environment.NewLine;
			Assert.Less(e2,e1);
		}

3. Example

Project: ContinuousTests
Source File: LessFixture.cs
View license
[Test, ExpectedException( typeof( AssertionException ))]
		public void NotLessIComparable()
		{
			expectedMessage =
				"  Expected: less than StoredProcedure" + Environment.NewLine +
				"  But was:  TableDirect" + Environment.NewLine;
			Assert.Less(e2,e1);
		}

4. Example

Project: impromptu-interface
Source File: ClayTest.cs
View license
[Test]
        [Category("Performance")]
        public void SpeedTestPrototype()
        {
        /n ..... /n //View Source file for more details /n }

5. Example

Project: impromptu-interface
Source File: ClayTest.cs
View license
[Test]
        [Category("Performance")]
        public void SpeedTestInterface()
        {   
     /n ..... /n //View Source file for more details /n }

6. Example

Project: whois
Source File: EmbeddedPatternReaderTest.cs
View license
[Test]
        public void TestListAllWhoisPatterns()
        {
            var patterns = reader.GetResourceNames();

            Assert.Less(0, patterns.Count);
        }

7. Example

View license
[Test]
        public void CompareTo_WithLessTicks_IsLess()
        {
            Assert.Less(negativeFiftyMillion.CompareTo(one), 0, "-50,000,000 < 1");
            Assert.Less(one.CompareTo(threeMillion), 0, "1 < 3,000,000");
            Assert.Less(negativeFiftyMillion.CompareTo(negativeOne), 0, "-50,000,000 > -1");
            Assert.Less(LocalInstant.MinValue.CompareTo(LocalInstant.MaxValue), 0, "MinValue < MaxValue");
        }

8. Example

Project: NodaTime
Source File: SystemClockTest.cs
View license
[Test]
        public void Sanity()
        {
            // Previously all the conversions missed the SystemConversions.DateTimeEpochTicks,
            // so they were self-consistent but not consistent with sanity.
            Instant minimumExpected = Instant.FromUtc(2011, 8, 1, 0, 0);
            Instant maximumExpected = Instant.FromUtc(2020, 1, 1, 0, 0);
            Instant now = SystemClock.SystemNow;
            Assert.Less(minimumExpected.Ticks, now.Ticks);
            Assert.Less(now.Ticks, maximumExpected.Ticks);
        }

9. Example

View license
public static IComparable ShouldBeLessThan(this IComparable arg1, IComparable arg2)
        {
            Assert.Less(arg1, arg2);
            return arg2;
        }

10. Example

Project: Migrant
Source File: HooksTests.cs
View license
[Test]
        public void ShouldInvokeLateHooksInCorrectOrder()
        {
            var forLateOrderTest = new ForLateOrderTestA { B = new ForLateOrderTestB() };
            var copy = SerializerClone(forLateOrderTest);
            Assert.Less(forLateOrderTest.B.HookInvokedOn, forLateOrderTest.HookInvokedOn);
            Assert.Less(copy.B.HookInvokedOn, copy.HookInvokedOn);
        }

11. Example

Project: Migrant
Source File: HooksTests.cs
View license
[Test]
        public void ShouldInvokeImmediateHooksInCorrectOrder()
        {
            var forOrderTest = new ForOrderTestA { B = new ForOrderTestB() };
            var copy = SerializerClone(forOrderTest);
            Assert.Less(forOrderTest.B.HookInvokedOn, forOrderTest.HookInvokedOn);
            Assert.Less(copy.B.HookInvokedOn, copy.HookInvokedOn);
        }

12. Example

View license
[Test]
		public void SimpleVariablesList ()
		{
			var completionData = Session.ActiveThread.Backtrace.GetFrame (0).GetExpressionCompletionData ("");
			Assert.Less (0, completionData.Items.Count);
		}

13. Example

Project: n2cms
Source File: UtilityTests.cs
View license
[Test]
        public void UpdateSortOrder_CanFixOrder_OnLastItem()
        {
            item1.SortOrder = 1;
            item2.SortOrder = 2;
            item3.SortOrder = 3;
            item4.SortOrder = 4;
            item5.SortOrder = 0;

            IEnumerable<ContentItem> changedItems = N2.Utility.UpdateSortOrder(items);

            EnumerableAssert.Count(1, changedItems);
            Assert.Less(item4.SortOrder, item5.SortOrder);
        }

14. Example

Project: Dominion
Source File: SpecificationExtensions.cs
View license
public static IComparable ShouldBeLessThan(this IComparable arg1, IComparable arg2)
        {
            Assert.Less(arg1, arg2);
            return arg2;
        }

15. Example

Project: Dominion
Source File: SpecificationExtensions.cs
View license
public static IComparable ShouldBeLessThan(this IComparable arg1, IComparable arg2)
        {
            Assert.Less(arg1, arg2);
            return arg2;
        }

16. Example

View license
[Test]
		public void CompareBookStrings()
		{
			Assert.Less(m_comparer.Compare("MAT 1:1", "MRK 1:1"), 0);
		}

17. Example

View license
[Test]
		public void CompareScrRefBooks()
		{
			ScrReference gen = new ScrReference(1, 1, 1, ScrVers.English);
			ScrReference exo = new ScrReference(2, 1, 1, ScrVers.English);

			Assert.Less(m_comparer.Compare(gen, exo), 0);
		}

18. Example

View license
[Test]
		public void CompareBCVBooks()
		{
			Assert.Less(m_comparer.Compare(01001001, 02001001), 0); // GEN 1:1, EXO 1:1
		}

19. Example

Project: libpalaso
Source File: ExtensibleTests.cs
View license
[Test]
		public void Construct_CreationTimeRecent()
		{
			Extensible e = new Extensible();
			// created less than one second ago
			Assert.Less(DateTime.UtcNow - e.CreationTime, new TimeSpan(0, 0, 1));
		}

20. Example

View license
[Test]
		public void FindAllAudioTracks_Test_GetCount()
		{
			_audioTracks = _api.FindAllAudioTracks(1, 0); // count is retrieved by default

			// just make sure the field is getting set
			Assert.Less(1, _audioTracks.TotalCount);
		}

21. Example

View license
[Test]
		public void FindAllAudioTracks_Test_PageNum()
		{
			_audioTracks = _api.FindAllAudioTracks(1, 1, SortBy.CreationDate);

			Assert.Less(0, _audioTracks.PageNumber);
		}

22. Example

Project: AutoTest.Net
Source File: LessFixture.cs
View license
[Test, ExpectedException( typeof( AssertionException ))]
		public void NotLessIComparable()
		{
			expectedMessage =
				"  Expected: less than StoredProcedure" + Environment.NewLine +
				"  But was:  TableDirect" + Environment.NewLine;
			Assert.Less(e2,e1);
		}

23. Example

Project: AutoTest.Net
Source File: LessFixture.cs
View license
[Test, ExpectedException( typeof( AssertionException ))]
		public void NotLessIComparable()
		{
			expectedMessage =
				"  Expected: less than StoredProcedure" + Environment.NewLine +
				"  But was:  TableDirect" + Environment.NewLine;
			Assert.Less(e2,e1);
		}

24. Example

Project: AutoTest.Net
Source File: LessFixture.cs
View license
[Test, ExpectedException( typeof( AssertionException ))]
		public void NotLessIComparable()
		{
			expectedMessage =
				"  Expected: less than StoredProcedure" + Environment.NewLine +
				"  But was:  TableDirect" + Environment.NewLine;
			Assert.Less(e2,e1);
		}

25. Example

Project: MonoGame.Extended
Source File: AngleTest.cs
View license
[Test]
        public void WrapTest()
        {
            for (var f = -10f; f < 10f; f += 0.1f)
            {
                var wrappositive = new Angle(f);
                wrappositive.WrapPositive();

                var wrap = new Angle(f);
                wrap.Wrap();

                Assert.GreaterOrEqual(wrappositive.Radians, 0);
                Assert.Less(wrappositive.Radians, 2d * MathHelper.Pi);

                Assert.GreaterOrEqual(wrap.Radians, -MathHelper.Pi);
                Assert.Less(wrap.Radians, MathHelper.Pi);
            }
        }

26. Example

Project: kafka-sharp
Source File: TestRoutingTable.cs
View license
[Test]
        public void TestRoutingTableReturnsEmptyForAbsentTopic()
        {
            var node = new NodeMock();
            var routes = new Dictionary<string, Partition[]>
                {
                    {"test1p", new[] {new Partition {Id = 0, Leader = node}}},
                };
            var routingTable = new RoutingTable(routes);

            Assert.Less(0, routingTable.GetPartitions("test1p").Length);
            Assert.AreEqual(0, routingTable.GetPartitions("tortemoque").Length);
        }

27. Example

Project: messageVault
Source File: MessageIdTests.cs
View license
[Test]
		public void Comparable()
		{
			var a = MessageId.CreateNew(0);
			var b = MessageId.CreateNew(0);
			Assert.Greater(b, a);
			Assert.Less(a,b);
		}

28. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void CacheableMethodPocoGetValuePassNullTimed()
        {
#if DEBUG
            Assert.Ignore("Visual Studio slows down dynamic too much in debug mode");
#endif

            var tValue = new OverloadingMethPoco();



            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, "Func", argCount:1);

            Timer.Action1=(() => { var tOut = tCachedInvoke.Invoke(tValue, null); });
            var tMethodInfo = tValue.GetType().GetMethod("Func", new Type[] { typeof(object) });
            Timer.Action2=(() =>
            {
                var tOut = tMethodInfo.Invoke(tValue, new object[] { null });
            });
                
            var elapsed = Timer.Go();

            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

29. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void CacheableSetTimed()
        {

            var tPoco1 = new PropPoco();
            var tPoco2 = new PropPoco();

            var tSetValue = "1";

            var tCacheable = new CacheableInvocation(InvocationKind.Set, "Prop1");
            Timer.Action1 = () => tCacheable.Invoke(tPoco1, tSetValue);

            var tPropertyInfo = tPoco2.GetType().GetProperty("Prop1");
            Timer.Action2 = () => tPropertyInfo.SetValue(tPoco2, tSetValue, new object[] { });

            var elapsed = Timer.Go();


            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

30. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void MethodPocoGetValuePassNullDoubleCallTimed()
        {
#if DEBUG
            Assert.Ignore("Visual Studio slows down dynamic too much in debug mode");
#endif
            var tValue = new OverloadingMethPoco();


            Timer.Action1=(() => { 
                var tOut = Dynamic.InvokeMember(tValue, "Func", null); 
                var tOut2 = Dynamic.InvokeMember(tValue, "Func", 2); });

            var tMethodInfo = tValue.GetType().GetMethod("Func", new Type[] { typeof(object) });
            var tMethodInfo2 = tValue.GetType().GetMethod("Func", new Type[] { typeof(int) });
            Timer.Action2=(() =>
            {
                var tOut = tMethodInfo.Invoke(tValue, new object[] { null });
                var tOut2 = tMethodInfo2.Invoke(tValue, new object[] { 2 });
            });

            var elapsed = Timer.Go(3 * TimeIt.Million);

            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

31. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void SetTimed()
        {

#if DEBUG
            Assert.Ignore("Visual Studio slows down dynamic too much in debug mode");
#endif
            
            var tPoco1 = new PropPoco();
            var tPoco2 = new PropPoco();
            var tSetValue = "1";

            Timer.Action1 = () => Dynamic.InvokeSet(tPoco1, "Prop1", tSetValue);
            var tPropertyInfo = tPoco2.GetType().GetProperty("Prop1");
            Timer.Action2 = () => tPropertyInfo.SetValue(tPoco2, tSetValue, new object[] { });

            var elapsed = Timer.Go(5* TimeIt.Million);

            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

32. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void CacheableMethodPocoGetValuePassNullDoubleCallTimed()
        {
            var tValue = new OverloadingMethPoco();

            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, "Func", 1);
            Timer.Action1=(() =>
            {
                var tOut = tCachedInvoke.Invoke(tValue, null);
                var tOut2 = tCachedInvoke.Invoke(tValue, 2);
            });

            var tMethodInfo = tValue.GetType().GetMethod("Func", new Type[] { typeof(object) });
            var tMethodInfo2 = tValue.GetType().GetMethod("Func", new Type[] { typeof(int) });
            Timer.Action2=(() =>
            {
                var tOut = tMethodInfo.Invoke(tValue, new object[] { null });
                var tOut2 = tMethodInfo2.Invoke(tValue, new object[] { 2 });
            });
                   
            var elapsed = Timer.Go();

             Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

33. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void TupleIndexTimed()
        {

            object tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);

            Timer.Action1 = () => Tupler.Index(tup,14);

            Timer.Action2 = () => FSharpValue.GetTupleField(tup,14);

            var elapsed = Timer.Go(50000);


            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("FSharp Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS FSharp Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

34. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void SetNullTimed()
        {
#if DEBUG
            Assert.Ignore("Visual Studio slows down dynamic too much in debug mode");
#endif
            var tPoco1 = new PropPoco();
            var tPoco2 = new PropPoco();

            String tSetValue = null;

            Timer.Action1 = () => Dynamic.InvokeSet(tPoco1, "Prop1", tSetValue);
            var tPropertyInfo = tPoco2.GetType().GetProperty("Prop1");
            Timer.Action2 = () => tPropertyInfo.SetValue(tPoco2, tSetValue, new object[] { });

            var elapsed = Timer.Go(5 * TimeIt.Million);


            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

35. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void CacheableSetNullTimed()
        {
            var tPoco = new PropPoco();

            String tSetValue = null;
            var tCachedInvoke = new CacheableInvocation(InvocationKind.Set, "Prop1");
            Timer.Action1 = (() => tCachedInvoke.Invoke(tPoco, tSetValue));
            var tPropertyInfo = tPoco.GetType().GetProperty("Prop1");
            Timer.Action2 = (() => tPropertyInfo.SetValue(tPoco, tSetValue, new object[] { }));

            var elapsed = Timer.Go();

            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

36. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void TupleToListTimed()
        {

            object tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);

            Timer.Action1 = () => Tupler.ToList(tup);
        
            Timer.Action2 = () => FSharpValue.GetTupleFields(tup).ToList();

            var elapsed = Timer.Go(50000);


            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("FSharp Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS FSharp Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

37. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void CacheableGetValueTimed()
        {
            var tSetValue = "1";
            var tAnon = new PropPoco() { Prop1 = tSetValue };


            var tInvoke = new CacheableInvocation(InvocationKind.Get, "Prop1");
            Timer.Action1 = () => { var tOut = tInvoke.Invoke(tAnon); };

            var tPropertyInfo = tAnon.GetType().GetProperty("Prop1");
            Timer.Action2 = () =>
                                {
                                    var tOut = tPropertyInfo.GetValue(tAnon, null);
                                };

            var elapsed = Timer.Go(2*TimeIt.Million);


            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

38. Example

Project: dynamitey
Source File: SpeedTest.cs
View license
[Test]
        public void MethodPocoGetValuePassNullTimed()
        {
#if DEBUG
            Assert.Ignore("Visual Studio slows down dynamic too much in debug mode");
#endif

            var tValue = new OverloadingMethPoco();


            Timer.Action1=(() => { var tOut = Dynamic.InvokeMember(tValue, "Func", null); });
            var tMethodInfo = tValue.GetType().GetMethod("Func", new Type[] { typeof(object)});
            Timer.Action2=(() =>
            {
                var tOut = tMethodInfo.Invoke(tValue, new object[] { null});
            });

          
             var elapsed = Timer.Go(3 * TimeIt.Million);

            Console.WriteLine("Impromptu: " + elapsed.Item1);
            Console.WriteLine("Refelection: " + elapsed.Item2);
            Console.WriteLine("Impromptu VS Reflection: {0}", TimeIt.RelativeSpeed(elapsed));
            Assert.Less(elapsed.Item1, elapsed.Item2);
        }

39. Example

Project: GeneticSharp
Source File: TspTest.cs
View license
[Test()]
        public void Evolve_ManyGenerations_Fast()
        {
            int numberOfCities = 40;
            var selection = new EliteSelection();
            var crossover = new OrderedCrossover();
            var mutation = new TworsMutation();
            var chromosome = new TspChromosome(numberOfCities);
            var fitness = new TspFitness(numberOfCities, 0, 1000, 0, 1000);

            var population = new Population(40, 40, chromosome);

            var ga = new GeneticAlgorithm(population, fitness, selection, crossover, mutation);

            ga.Start();
            var firstDistance = ((TspChromosome)ga.Population.BestChromosome).Distance;

            ga.Termination = new GenerationNumberTermination(1001);

            TimeAssert.LessThan(100000, () =>
            {
                ga.Start();
            });

            var lastDistance = ((TspChromosome)ga.Population.BestChromosome).Distance;

            Assert.Less(lastDistance, firstDistance);
        }

40. Example

Project: GeneticSharp
Source File: EqualityFitnessTest.cs
View license
[Test()]
		public void Evaluate_DiffChromosomes_DiffFitness()
		{
			var target = new EqualityFitness();

			var chromosome = new EquationChromosome(30, 4);
			chromosome.ReplaceGene(0, new Gene(0));
			chromosome.ReplaceGene(1, new Gene(7));
			chromosome.ReplaceGene(2, new Gene(-43));
			chromosome.ReplaceGene(3, new Gene(32));

			var actual = target.Evaluate(chromosome);
			Assert.Less(actual, 0);

			chromosome = new EquationChromosome(30, 4);
			chromosome.ReplaceGene(0, new Gene(17));
			chromosome.ReplaceGene(1, new Gene(7));
			chromosome.ReplaceGene(2, new Gene(-43));
			chromosome.ReplaceGene(3, new Gene(32));

		    actual = target.Evaluate(chromosome); 
			Assert.AreEqual(0, actual);
		}

41. Example

Project: NodaTime
Source File: SystemClockTest.cs
View license
[Test]
        public void SystemNow()
        {
            long frameworkNowTicks = DateTime.UtcNow.Ticks - NodaConstants.DateTimeEpochTicks;
            long nodaTicks = SystemClock.SystemNow.Ticks;
            Assert.Less(Math.Abs(nodaTicks - frameworkNowTicks), Duration.FromSeconds(1).Ticks);
        }

42. Example

Project: NodaTime
Source File: SystemClockTest.cs
View license
[Test]
        public void InstanceNow()
        {
            long frameworkNowTicks = DateTime.UtcNow.Ticks - NodaConstants.DateTimeEpochTicks;
            long nodaTicks = SystemClock.Instance.Now.Ticks;
            Assert.Less(Math.Abs(nodaTicks - frameworkNowTicks), Duration.FromSeconds(1).Ticks);
        }

43. Example

View license
[Test]
        public void Coparable_Smaller()
        {
            var result = (55.9).NullableCompareTo(56.0);
            Assert.NotNull(result);
            Assert.Less(result.Value, 0, "Should return a value greater than zero");
        }

44. Example

Project: machine
Source File: ClockTests.cs
View license
[Test]
    public void CurrentTime_Always_IsTime()
    {
      DateTime now = _target.CurrentTime;
      Assert.Less(DateTime.Now - now, TimeSpan.FromMilliseconds(1000));
    }

45. Example

Project: n2cms
Source File: UtilityTests.cs
View license
[Test]
        public void UpdateSortOrder_SetsUniqueSortOrder_ForEachItem()
        {
            Assert.AreEqual(0, item1.SortOrder);
            Assert.AreEqual(0, item2.SortOrder);
            Assert.AreEqual(0, item3.SortOrder);
            Assert.AreEqual(0, item4.SortOrder);
            Assert.AreEqual(0, item5.SortOrder);

            IEnumerable<ContentItem> changedItems = N2.Utility.UpdateSortOrder(items);

            EnumerableAssert.Count(4, changedItems);

            Assert.Less(item1.SortOrder, item2.SortOrder);
            Assert.Less(item2.SortOrder, item3.SortOrder);
            Assert.Less(item3.SortOrder, item4.SortOrder);
            Assert.Less(item4.SortOrder, item5.SortOrder);
        }

46. Example

Project: n2cms
Source File: TrashHandlerTests.cs
View license
[Test]
        public void ThrownItem_OldValues_AreStored_InDetailBag()
        {
            TrashHandler th = CreateTrashHandler();
            th.Throw(item);

            Assert.AreEqual("item", item[TrashHandler.FormerName]);
            Assert.AreEqual(root, item[TrashHandler.FormerParent]);
            Assert.Less(N2.Utility.CurrentTime().AddSeconds(-10), (DateTime)item[TrashHandler.DeletedDate]);
        }

47. Example

View license
[Test]
        public void ZipfPDFValuesDecrease()
        {
            var n = 1000;
            var alpha = .01;
            var zipf = new ZipfDistribution(n, alpha, 5, 0.01);
            var prevPdf = zipf.PDF(1);
            Assert.IsTrue(prevPdf < 1 && prevPdf > 0, $"PDF(1) is out of range: {prevPdf}");
            for(var rank = 2; rank <= n; rank++)
            {
                var pdf = zipf.PDF(rank);
                Assert.Less(pdf, prevPdf, $"PDF({rank}) is not less than PDF({rank-1}): {pdf}");
                prevPdf = pdf;
            }
        }

48. Example

View license
[TestCaseSource(typeof(FileSystemSource), "ReadWriteFileSystems")]
        public void LastAccessTime(NewFileSystemDelegate fsFactory)
        {
            DiscFileSystem fs = fsFactory();

            fs.CreateDirectory("DIR");
            DiscDirectoryInfo di = fs.GetDirectoryInfo("DIR");

            DateTime baseTime = DateTime.Now - TimeSpan.FromDays(2);
            di.LastAccessTime = baseTime;

            fs.CreateDirectory(@"DIR\CHILD");

            Assert.Less(baseTime, di.LastAccessTime);
        }

49. Example

Project: discutils
Source File: DiscFileSystemFileTest.cs
View license
[TestCaseSource(typeof(FileSystemSource), "ReadWriteFileSystems")]
        public void LastAccessTime(NewFileSystemDelegate fsFactory)
        {
            DiscFileSystem fs = fsFactory();

            using (Stream s = fs.OpenFile("foo.txt", FileMode.Create)) { }
            DiscFileInfo fi = fs.GetFileInfo("foo.txt");

            DateTime baseTime = DateTime.Now - TimeSpan.FromDays(2);
            fi.LastAccessTime = baseTime;

            using (Stream s = fs.OpenFile("foo.txt", FileMode.Open, FileAccess.Read)) { }

            Assert.Less(baseTime, fi.LastAccessTime);
        }

50. Example

View license
[TestCaseSource(typeof(FileSystemSource), "ReadWriteFileSystems")]
        public void LastWriteTime(NewFileSystemDelegate fsFactory)
        {
            DiscFileSystem fs = fsFactory();

            fs.CreateDirectory("DIR");
            DiscDirectoryInfo di = fs.GetDirectoryInfo("DIR");

            DateTime baseTime = DateTime.Now - TimeSpan.FromMinutes(10);
            di.LastWriteTime = baseTime;

            fs.CreateDirectory(@"DIR\CHILD");

            Assert.Less(baseTime, di.LastWriteTime);
        }