示例#1
0
        public void NotificationResult_SetData()
        {
            // Arrange
            var notificationResult = new NotificationResult();

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

            // Assert
            Assert.IsTrue(notificationResult.Errors.Count == 0);
            Assert.IsTrue(notificationResult.IsValid);
            Assert.IsTrue(notificationResult.SuccessMessage == SuccessMessage);
            Assert.IsTrue(data.Any(x => x == "Um"));
            Assert.IsTrue(data.Any(x => x == "Dois"));
        }
示例#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);
        }