Example #1
0
                public void DifferentCents_ReturnsFalse()
                {
                    Usd x = new Usd(1);
                    Usd y = new Usd(2);

                    Assert.False(x == y);
                }
Example #2
0
                public void SameCents_ReturnsTrue()
                {
                    Usd x = new Usd(1);
                    Usd y = new Usd(1);

                    Assert.True(x == y);
                }
Example #3
0
                public void DifferentCents_ReturnsTrue()
                {
                    Usd x = new Usd(1);
                    Usd y = new Usd(2);

                    Assert.True(x != y);
                }
Example #4
0
                public void NullY_ReturnsFalse()
                {
                    Usd x = new Usd(1);
                    Usd y = null !;

                    Assert.False(x == y);
                }
Example #5
0
                public void NullXAndNullY_ReturnsFalse()
                {
                    Usd x = null !;
                    Usd y = null !;

                    Assert.False(x != y);
                }
Example #6
0
                public void NullY_ReturnsTrue()
                {
                    Usd x = new Usd(1);
                    Usd y = null !;

                    Assert.True(x != y);
                }
Example #7
0
                public void NullXAndNullY_ReturnsTrue()
                {
                    Usd x = null !;
                    Usd y = null !;

                    Assert.True(x == y);
                }
Example #8
0
                public void SameCents_ReturnsFalse()
                {
                    Usd x = new Usd(1);
                    Usd y = new Usd(1);

                    Assert.False(x != y);
                }
Example #9
0
                public void SameReference_ReturnsFalse()
                {
                    Usd usd = new Usd(1);
                    Usd x   = usd;
                    Usd y   = usd;

                    Assert.False(x != y);
                }
Example #10
0
                public void SameReference_ReturnsTrue()
                {
                    Usd usd = new Usd(1);
                    Usd x   = usd;
                    Usd y   = usd;

                    Assert.True(x == y);
                }
Example #11
0
            public void WhenCentsEquals100_Returns1()
            {
                var price = new Usd(100);

                Assert.Equal("$1", price.DisplayPrice);
            }
Example #12
0
                public void NotUsdObj_ReturnsFalse()
                {
                    var usd = new Usd(0);

                    Assert.False(usd.Equals("string"));
                }
Example #13
0
                public void CentsEqualsOne_SetsCents()
                {
                    var usd = new Usd(1);

                    Assert.Equal(1, usd.Cents);
                }
Example #14
0
                public void SameReferenceObj_ReturnsTrue()
                {
                    var usd = new Usd(0);

                    Assert.True(usd.Equals(usd));
                }
Example #15
0
                public void UsdObjWithDifferentCents_ReturnsFalse()
                {
                    var usd = new Usd(0);

                    Assert.False(usd.Equals(new Usd(1)));
                }
Example #16
0
                public void UsdObjWithSameCents_ReturnsTrue()
                {
                    var usd = new Usd(0);

                    Assert.True(usd.Equals(new Usd(0)));
                }
Example #17
0
                public void NullObj_ReturnsFalse()
                {
                    var usd = new Usd(0);

                    Assert.False(usd.Equals(obj: null !));
                }
Example #18
0
                public void OneHundredCents_ReturnsFormatted()
                {
                    var usd = new Usd(100);

                    Assert.Equal("$1.00", usd.ToString());
                }
Example #19
0
                public void CentsEqualsZero_SetsCents()
                {
                    var usd = new Usd(0);

                    Assert.Equal(0, usd.Cents);
                }
Example #20
0
                public void OneCent_ReturnsFormatted()
                {
                    var usd = new Usd(1);

                    Assert.Equal("$0.01", usd.ToString());
                }
Example #21
0
                public void TenThousandCents_ReturnsFormatted()
                {
                    var usd = new Usd(10000);

                    Assert.Equal("$100.00", usd.ToString());
                }
Example #22
0
                public void WhenCalled_ReturnsCentsGetHashCode()
                {
                    var usd = new Usd(1);

                    Assert.Equal(HashCode.Combine(usd.Cents), usd.GetHashCode());
                }
Example #23
0
                public void TenCents_ReturnsFormatted()
                {
                    var usd = new Usd(10);

                    Assert.Equal("$0.10", usd.ToString());
                }
Example #24
0
            public void WhenCentsEquals199_Returns199()
            {
                var price = new Usd(199);

                Assert.Equal("$1.99", price.DisplayPrice);
            }