Exemplo n.º 1
0
            public void Should_Return_False_When_Source_Type_Is_Not_DirectoryPath()
            {
                var converter = new DirectoryPathConverter();

                var result = converter.CanConvertTo(typeof(DateTime));

                Assert.False(result);
            }
Exemplo n.º 2
0
            public void Should_Return_True_When_Destination_Type_Is_DirectoryPath()
            {
                var converter = new DirectoryPathConverter();

                var result = converter.CanConvertTo(typeof(DirectoryPath));

                Assert.True(result);
            }
Exemplo n.º 3
0
            public void Should_Throw_NotSupportedException_When_Value_Is_Not_A_Valid_Directory_Path()
            {
                var converter = new DirectoryPathConverter();

                var result = Record.Exception(() => converter.ConvertFrom(DateTime.Now));

                Assert.IsType <NotSupportedException>(result);
            }
Exemplo n.º 4
0
            public void Should_Return_True_When_Source_Type_Is_String()
            {
                var converter = new DirectoryPathConverter();

                var result = converter.CanConvertFrom(typeof(string));

                Assert.True(result);
            }
Exemplo n.º 5
0
            public void Should_Convert_Directory_Path_To_String_Value_Using_FullPath()
            {
                var converter = new DirectoryPathConverter();

                var result = converter.ConvertTo(DirectoryPath.FromString("c:/data/work"), typeof(string));

                Assert.IsType <string>(result);
                Assert.Equal("c:/data/work", result);
            }
Exemplo n.º 6
0
            public void Should_Convert_String_Value_To_Directory_Path()
            {
                var converter = new DirectoryPathConverter();

                var result = converter.ConvertFrom("c:/data/work");

                Assert.IsType <DirectoryPath>(result);
                Assert.Equal("c:/data/work", ((DirectoryPath)result).FullPath);
            }
Exemplo n.º 7
0
            public void Should_Throw_NotSupportedException_When_Destination_Type_Is_Not_String()
            {
                var converter = new DirectoryPathConverter();

                var result = Record.Exception(() =>
                                              converter.ConvertTo(DirectoryPath.FromString("c:/data/work"), typeof(DateTime)));

                Assert.IsType <NotSupportedException>(result);
            }