public void CreateValid_ReturnsOk() { //Arrange RationNumber value = new RationNumber(10, 2); //Assert Assert.NotNull(value); }
public void OperatorEquals_NullAndNotNull_ReturnsException() { //Arrange RationNumber valueA = null; RationNumber valueB = new RationNumber(11, 2); //Act //Assert Assert.Throws <NullReferenceException>(() => valueA == valueB); }
public void N10D3ConvertToInt_Returns3() { //Arrange RationNumber valueA = new RationNumber(10, 3); //Act var result = (float)valueA; //Assert Assert.Equal(expected: (int)(10 / 3), result); }
public void N2D3Decrement_ReturnsN1D2() { //Arrange RationNumber valueA = new RationNumber(2, 3); //Act var result = valueA--; //Assert Assert.Equal(expected: new RationNumber(1, 2), result); }
public void OperatorEquals_Nulls_ReturnsTrue() { //Arrange RationNumber valueA = null; RationNumber valueB = null; //Act bool result = valueA == valueB; //Assert Assert.True(result); }
public void N10D2DTakingRemainderN4D2_ReturnsN16D16() { //Arrange RationNumber valueA = new RationNumber(10, 2); RationNumber valueB = new RationNumber(4, 2); //Act var result = valueA % valueB; //Assert Assert.Equal(expected: new RationNumber(16, 16), result); }
public void Equals_ReturnsFalse() { //Arrange RationNumber valueA = new RationNumber(10, 2); RationNumber valueB = new RationNumber(11, 2); //Act bool result = valueA.Equals(valueB); //Assert Assert.False(result); }
public void N2D3DivisionN4D5_ReturnsN10D12() { //Arrange RationNumber valueA = new RationNumber(2, 3); RationNumber valueB = new RationNumber(4, 5); //Act var result = valueA / valueB; //Assert Assert.Equal(expected: new RationNumber(10, 12), result); }
public void OperatorNotEquals_NotNulls_ReturnsTrue() { //Arrange RationNumber valueA = new RationNumber(11, 2); RationNumber valueB = new RationNumber(12, 2); //Act bool result = valueA != valueB; //Assert Assert.True(result); }
public void N1D3LessOrEqualN1D3_ReturnsTrue() { //Arrange RationNumber valueA = new RationNumber(1, 3); RationNumber valueB = new RationNumber(1, 3); //Act bool result = valueA <= valueB; //Assert Assert.True(result); }
public void N1D2GreaterOrEqualN1D2_ReturnsTrue() { //Arrange RationNumber valueA = new RationNumber(1, 2); RationNumber valueB = new RationNumber(1, 2); //Act bool result = valueA >= valueB; //Assert Assert.True(result); }
public void N1D3LessN1D3_ReturnsFalse() { //Arrange RationNumber valueA = new RationNumber(1, 3); RationNumber valueB = new RationNumber(1, 3); //Act bool result = valueA < valueB; //Assert Assert.False(result); }
public void N1D2GreaterN1D2_ReturnsFalse() { //Arrange RationNumber valueA = new RationNumber(1, 2); RationNumber valueB = new RationNumber(1, 2); //Act bool result = valueA > valueB; //Assert Assert.False(result); }
public void N1D3MinusN1D4_ReturnsN1D12() { //Arrange RationNumber valueA = new RationNumber(1, 3); RationNumber valueB = new RationNumber(1, 4); //Act var result = valueA - valueB; //Assert Assert.Equal(expected: new RationNumber(1, 12), result); }
public void N1D2MinusN1D2_ReturnsN0D2() { //Arrange RationNumber valueA = new RationNumber(1, 2); RationNumber valueB = new RationNumber(1, 2); //Act var result = valueA - valueB; //Assert Assert.Equal(expected: new RationNumber(0, 2), result); }
public void N1D2MultiplicationN4D5_ReturnsN4D10() { //Arrange RationNumber valueA = new RationNumber(1, 2); RationNumber valueB = new RationNumber(4, 5); //Act var result = valueA * valueB; //Assert Assert.Equal(expected: new RationNumber(4, 10), result); }
public void OperatorEquals_NotNullAndNull_ReturnsFalse() { //Arrange RationNumber valueA = new RationNumber(11, 2); RationNumber valueB = null; //Act bool result = valueA == valueB; //Assert Assert.False(result); }
public void OperatorNotEquals_ReturnsFalse() { //Arrange RationNumber valueA = new RationNumber(10, 2); RationNumber valueB = new RationNumber(10, 2); //Act bool result = valueA != valueB; //Assert Assert.False(result); }