Ejemplo n.º 1
0
        public void CallPropertyWithSetAndGet(Type @class)
        {
            dynamic sutPrivate = new ReachPrivateIn(@class);

            sutPrivate.MyProperty = 12;

            var res = sutPrivate.MyProperty;

            Assert.Equal(12, res);
        }
Ejemplo n.º 2
0
        public void CallMethodWithAndWithoutReturnValue(Type @class)
        {
            dynamic sutPrivate = new ReachPrivateIn(@class);

            sutPrivate.SetMethod("my name");

            var res = sutPrivate.GetMethod();

            Assert.Equal("my name", res);
        }
Ejemplo n.º 3
0
        public void CallFieldWithAndWithoutReturnValue(Type @class)
        {
            dynamic sutPrivate = new ReachPrivateIn(@class);

            sutPrivate._myField = 13;

            var res = sutPrivate._myField;

            Assert.Equal(13, res);
        }
Ejemplo n.º 4
0
        public void CallNonExistingMethod(Type @class)
        {
            dynamic sutPrivate = new ReachPrivateIn(@class);

            Assert.Throws <ArgumentException>(() =>
                                              sutPrivate.NonExistingVoidMethod(12)
                                              );

            Assert.Throws <ArgumentException>(() =>
            {
                var x = sutPrivate.NonExistingReturningMethod("abc");
            });
        }
Ejemplo n.º 5
0
        public void CallNonExistingFieldOrProperty(Type @class)
        {
            dynamic sutPrivate = new ReachPrivateIn(@class);

            Assert.Throws <ArgumentException>(() =>
                                              sutPrivate.NonExistingProperty = 12
                                              );

            Assert.Throws <ArgumentException>(() =>
            {
                var x = sutPrivate.NonExistingProperty;
            });
        }
Ejemplo n.º 6
0
        public void SplitPathAndFilename_pathandfile_ReturnPathAndFilename()
        {
            //  #   Arrange.
            dynamic sutPrivate = new ReachPrivateIn(typeof(FileSystemHelper.FileEntity));
            var     pathfile   = IsWindows() ?
                                 @"C:\Temp\File.txt" :
                                 "/mnt/c/Temp/File.txt";
            var expectedPath = IsWindows() ?
                               @"C:\Temp" :
                               @"/mnt/c/Temp";

            //  #   Act.
            var res = sutPrivate.SplitToPathAndFilename(pathfile);

            //  #   Assert.
            Assert.AreEqual(expectedPath, res.Item1);
            Assert.AreEqual("File.txt", res.Item2);
        }