Example #1
0
 public static void ShouldBeAbleToCheckTheEqualityBetweenTheSameError()
 {
     //Arrange
     var error = new Error() { Code = "404", Title = "Not Found", Message = "Resource Not Found" };
     //Act
     //Assert
     Assert.Equal(error, error);
 }
Example #2
0
 public static void ShouldBeABleToTellIfAnErrorIsAValidErrorModel()
 {
     //Arrange
     var Error = new Error();
     //Act
     //Assert
     Assert.IsAssignableFrom<Model.Error>(Error);
 }
Example #3
0
 public static void ShouldBeAbleToTellTwoDifferentErrors()
 {
     //Arrange
     var error1 = new Error() { Code = "404", Title = "Not Found", Message = "Resource Not Found" };
     var error2 = new Error() { Code = "500", Title = "Internal Server Error", Message = "Internal Server Error" };
     //Act
     //Assert
     Assert.NotEqual(error1, error2);
 }
Example #4
0
 public static void ShouldBeAbleToCheckIfTwoErrorsWithTheSameValuesAreEqual()
 {
     //Arrange
     var error1 = new Error() { Code = "404", Title = "Not Found", Message = "Resource Not Found" };
     var error2 = new Error() { Code = "404", Title = "Not Found", Message = "Resource Not Found" };
     //Act
     //Assert
     Assert.Equal(error1, error2);
 }
Example #5
0
 public static void ShouldBeABleToCreateANewCollectionWithDefaultProperties()
 {
     //Arrange
     var Error = new Error();
     //Act
     //Assert
     Assert.Null(Error.Title);
     Assert.Null(Error.Message);
     Assert.Null(Error.Code);
 }
Example #6
0
 public static void ShouldBeAbleToSerializeToJsonAnError()
 {
     //Arrange
     var error = new Error() { Title = "test error", Message = "test error message", Code = "205" };
     var expectedAnswer = "{\"title\":\"test error\",\"code\":\"205\",\"message\":\"test error message\"}";
     //Act
     var realAnswer = JsonConvert.SerializeObject(error);
     //Assert
     Assert.Equal(expectedAnswer, realAnswer);
 }