예제 #1
0
        public void ItShould_throw_error_when_message_not_defined()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();

            // act
            sut.AddError(exception);

            // assert
            Assert.NotNull(sut.Exception);
        }
예제 #2
0
        public void ItShould_have_only_one_object_in_metadata_when_add_Error()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();

            // act
            sut.AddError(exception);

            // assert
            Assert.NotNull(sut.Metadata.Message);
        }
예제 #3
0
        public void ItShould_have_equals_types_for_DataObject_and_Exception()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();

            // act
            sut.AddError(exception).AddData(exception);

            // assert
            Assert.IsType <SimpleCustomException>(sut.Metadata.DataObject);
            Assert.IsType <SimpleCustomException>(sut.Exception);
        }
예제 #4
0
        public void ItShould_have_string_type_for_metadata_DataObject()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();

            // act
            sut.AddError(exception).AddData(exception);

            // assert
            Assert.NotNull(sut.Metadata.Message);
            Assert.IsType <SimpleCustomException>(sut.Exception);
        }
예제 #5
0
        public void ItShould_have_string_type_for_metadata_Warning()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();


            // act
            sut.AddWarning(exception.ToString());

            // assert
            Assert.Equal(MetadataType.Warning, sut.Metadata.Type);
        }
예제 #6
0
        public void ItShould_have_string_type_for_metadata_Error()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();

            // act
            sut.AddError(exception);

            // assert
            Assert.NotNull(sut.Metadata.Message);
            Assert.Equal(MetadataType.Error, sut.Metadata.Type);
        }
예제 #7
0
        public void ItShould_not_have_message_equals_when_DataObject_added_and_Metadata_message()
        {
            // arrange
            var          sut        = _fixture.Create <string>();
            const string expected   = "TEST";
            var          exception1 = new SimpleCustomException();
            var          exception2 = new CustomException(expected);

            // act
            sut.AddError(exception1).AddData(exception2);

            // assert
            Assert.NotEqual(expected, sut.Metadata.Message);
        }
예제 #8
0
        public void ItShould_have_exception_message_and_custom_message_when_added_both()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();
            var expected  = exception.Message;

            // act
            sut.AddError(expected);

            // assert
            Assert.NotNull(sut.Metadata);
            Assert.Equal(expected, sut.Metadata.Message);
        }
예제 #9
0
        public void ItShould_have_able_to_add_DataObject_Exception_after_AddError_should_have_other_message()
        {
            // arrange
            var sut        = _fixture.Create <string>();
            var exception1 = new SimpleCustomException();
            var exception2 = new CustomException(Messages.Title1);

            // act
            sut.AddError(exception1).AddData(exception2);

            // assert
            Assert.NotNull(sut.Metadata);
            Assert.NotNull(sut.Metadata.DataObject);
            Assert.NotNull(sut.Exception);
        }
예제 #10
0
        public void ItShould_have_only_one_object_in_metadata_when_add_Info_with_Error_added_before()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();
            var expected  = exception.Message;

            // act
            sut.AddInfo(exception.ToString());
            sut.AddError(expected);

            // assert
            Assert.NotNull(sut.Metadata);
            Assert.Equal(expected, sut.Metadata.Message);
        }
예제 #11
0
        public void ItShould_have_able_to_add_DataObject_Exception_after_AddError_should_have_message()
        {
            // arrange
            var sut  = _fixture.Create <string>();
            var data = new SimpleCustomException();

            // act
            sut.AddError(data).AddData(Messages.Title1);

            var actual = sut.Metadata.Message;

            // assert
            Assert.NotNull(sut.Metadata);
            Assert.NotNull(sut.Metadata.DataObject);
            Assert.NotEqual(Messages.Title1, actual);
        }
예제 #12
0
        public void ItShould_have_last_added_type_object_in_metadata()
        {
            // arrange
            var sut       = _fixture.Create <string>();
            var exception = new SimpleCustomException();
            var expected  = exception.Message;

            // act
            sut.AddWarning(expected);
            sut.AddInfo(exception.ToString());


            // assert
            Assert.NotNull(sut.Metadata);
            Assert.Equal(MetadataType.Info, sut.Metadata.Type);
        }