1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Tests
{
[TestFixture]
internal class FloatingPropertyViewModelTests
: NumericViewModelTests<double, double>
{
protected override double GetRandomTestValue (Random rand)
{
return rand.NextDouble ();
}
protected override NumericPropertyViewModel<double> GetViewModel (TargetPlatform platform, IPropertyInfo property, IEnumerable<IObjectEditor> editors)
{
return new NumericPropertyViewModel<double> (platform, property, editors);
}
protected override Tuple<double, double> MaxMin => new Tuple<double, double> (Double.MaxValue, Double.MinValue);
protected override double GetConstrainedRandomValue (Random rand, out double max, out double min)
{
int value = rand.Next (2, Int32.MaxValue - 2);
max = rand.Next (value + 1, Int32.MaxValue);
min = rand.Next (0, value - 1);
return value;
}
protected override double GetConstrainedRandomValueAboveBounds (Random rand, out double max, out double min)
{
int value = rand.Next (2, Int32.MaxValue - 2);
min = rand.Next (0, value - 1);
max = rand.Next ((int)min + 1, value - 1);
return value;
}
protected override double GetConstrainedRandomValueBelowBounds (Random rand, out double max, out double min)
{
int value = rand.Next (2, Int32.MaxValue - 2);
max = rand.Next (value + 1, Int32.MaxValue);
min = rand.Next (value + 1, (int)max - 1);
return value;
}
}
}
|