Bool Class

Represents a basic true/false value. Also Supports Null.

Definition

Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
C#
public abstract class Bool : DataTypeBase, 
	IComparable
Inheritance
Object    DataTypeBase    Bool
Implements
IComparable

Example

Bool behaviour
This example is in the form of Unit Tests. It references the NUnit framework. This framework can be downloaded from www.NUnit.org. For more information about unit testing visit: www.NUnit.org.
C#
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;

namespace TestFirefly.Box.Documentation
{
    [TestFixture]
    public class DemoBool
    {
        [Test]
        public void Test1()
        {
            Bool b = true;
            b.ShouldBe(true);
            b = false;
            b.ShouldBe(false);
            b = null;
            if (b)
            {
                throw new Exception("When b is null, it should behave as false");
            }
        }
    }
}

Constructors

BoolInitializes a new instance of the Bool class

Methods

CastCasts the object specified in the value parameter to a Bool. If the cast fails an InvalidCastException is thrown
CompareToCompares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
(Overrides DataTypeBaseCompareTo(Object))
EqualsDetermines whether the specified Object is equal to the current Object.
(Overrides ObjectEquals(Object))
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
IsSpecialNullInstance 
IsTrue 
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Not 
ToBoolean Converts to Boolean
ToIntTransforms the Bool to Int32
ToStringReturns a string that represents the current object.
(Inherited from Object)
ToString(String)Returns a String that represents the current Bool. The result string is formatted using the format provided in the format parameter.
(Overrides DataTypeBaseToString(String))
ToString(String, IFormatProvider)Returns a String that represents the value specified in format. The result string is formatted using the format provided in the format parameter.
(Inherited from DataTypeBase)
TryCastTries to cast the object specified in the value parameter to a Boolean.

Operators

Extension Methods

ShouldBeVerifies that the actual value matches the expected value
(Defined by Should)
ShouldBeVerifies that the actual value matches the expected value
(Defined by Should)

See Also