Exemple #1
0
 public AndConstraint <DegreeColourComponentAssertions> BeApproximately(ColourPrimitive expected, ColourPrimitive precision = (ColourPrimitive)(float.Epsilon), string because = "", params object[] becauseArgs)
 {
     Execute.Assertion
     .BecauseOf(because, becauseArgs)
     .TestElementApprox(expected, nameof(expected), Subject.Value, precision);
     return(new AndConstraint <DegreeColourComponentAssertions>(this));
 }
Exemple #2
0
 public AndConstraint <DegreeColourComponentAssertions> Be(ColourPrimitive expected, string because = "", params object[] becauseArgs)
 {
     Execute.Assertion
     .BecauseOf(because, becauseArgs)
     .TestElement(expected, nameof(expected), Subject.Value);
     return(new AndConstraint <DegreeColourComponentAssertions>(this));
 }
Exemple #3
0
 public AndConstraint <ColourVectorAssertions> BeApproximately(ColourVector expected, ColourPrimitive precision = (ColourPrimitive)(float.Epsilon), string because = "", params object[] becauseArgs)
 {
     Execute.Assertion
     .BecauseOf(because, becauseArgs)
     .TestElementApprox(expected.X, nameof(expected.X), Subject.X, precision)
     .TestElementApprox(expected.Y, nameof(expected.Y), Subject.Y, precision)
     .TestElementApprox(expected.Z, nameof(expected.Z), Subject.Z, precision);
     return(new AndConstraint <ColourVectorAssertions>(this));
 }
Exemple #4
0
 public AndConstraint <ColourMatrixAssertions> BeApproximately(ColourMatrix expected, ColourPrimitive precision = (ColourPrimitive)(float.Epsilon), string because = "", params object[] becauseArgs)
 {
     Execute.Assertion
     .BecauseOf(because, becauseArgs)
     .TestElementApprox(expected.M11, nameof(expected.M11), Subject.M11, precision)
     .TestElementApprox(expected.M12, nameof(expected.M12), Subject.M12, precision)
     .TestElementApprox(expected.M13, nameof(expected.M13), Subject.M13, precision)
     .TestElementApprox(expected.M21, nameof(expected.M21), Subject.M21, precision)
     .TestElementApprox(expected.M22, nameof(expected.M22), Subject.M22, precision)
     .TestElementApprox(expected.M23, nameof(expected.M23), Subject.M23, precision)
     .TestElementApprox(expected.M31, nameof(expected.M31), Subject.M31, precision)
     .TestElementApprox(expected.M32, nameof(expected.M32), Subject.M32, precision)
     .TestElementApprox(expected.M33, nameof(expected.M33), Subject.M33, precision);
     return(new AndConstraint <ColourMatrixAssertions>(this));
 }
Exemple #5
0
 public static Continuation TestElement(this AssertionScope scope, ColourPrimitive expected, string expectedName, ColourPrimitive actual)
 => scope.ForCondition(expected == actual).FailWith($"Expected {expectedName} to be {expected}, but it is {actual}.");
Exemple #6
0
 public static Continuation TestElement(this Continuation continuation, ColourPrimitive expected, string expectedName, ColourPrimitive actual)
 => continuation.Then.TestElement(expected, expectedName, actual);
Exemple #7
0
 public AndConstraint <HSLColourAssertions> BeApproximatelyIgoringAlpha(HSLColour expected, ColourPrimitive precision = (ColourPrimitive)(float.Epsilon), string because = "", params object[] becauseArgs)
 {
     Execute.Assertion
     .BecauseOf(because, becauseArgs)
     .TestElementApprox(expected.H, nameof(expected.H), Subject.H, precision)
     .TestElementApprox(expected.S, nameof(expected.S), Subject.S, precision)
     .TestElementApprox(expected.L, nameof(expected.L), Subject.L, precision);
     return(new AndConstraint <HSLColourAssertions>(this));
 }
        public void Test_DegreeColourComponent_Subtraction_generated()
        {
            ColourPrimitive diff = (ColourPrimitive)MID - (ColourPrimitive)STEP;

            (new DegreeColourComponent(MID) - new DegreeColourComponent(STEP)).Should().Be(diff, $"should subtract two DegreeColourComponent's");
        } // Test_DegreeColourComponent_Subtraction_generated()
        public void Test_DegreeColourComponent_Addition_generated()
        {
            ColourPrimitive sum = (ColourPrimitive)MID + (ColourPrimitive)STEP;

            (new DegreeColourComponent(MID) + new DegreeColourComponent(STEP)).Should().Be(sum, $"should add two DegreeColourComponent's");
        } // Test_DegreeColourComponent_Addition_generated()