Ejemplo n.º 1
0
        public void NotificationResult_SetError()
        {
            // Arrange
            var notificationResult = new NotificationResult();

            // Act
            notificationResult.SetError(ErrorMessage);

            // Assert
            Assert.IsTrue(notificationResult.Errors.Any(x => x == ErrorMessage));
            Assert.IsTrue(!notificationResult.IsValid);
            Assert.IsTrue(notificationResult.Errors.Count > 0);
            Assert.IsTrue(notificationResult.SuccessMessage == "");
        }
Ejemplo n.º 2
0
        public void NotificationResult_SetDataWithError()
        {
            // Arrange
            var notificationResult = new NotificationResult();

            // Act
            notificationResult.SetError(ErrorMessage);
            notificationResult.SetData(_object, SuccessMessage);
            var data = (List <string>)notificationResult.Data;

            // Assert
            Assert.IsTrue(notificationResult.Errors.Any(x => x == ErrorMessage));
            Assert.IsTrue(!notificationResult.IsValid);
            Assert.IsTrue(notificationResult.Errors.Count > 0);
            Assert.IsTrue(notificationResult.SuccessMessage == "");
            Assert.IsNull(notificationResult.Data);
            Assert.IsNull(data);
        }