Ejemplo n.º 1
0
        public void TestReverseWithOriginalString()
        {
            string reversed = ".eslaf eb t'ndluow ecnetnes siht ,dehctiws erew eslaf dna eurt fo sgninaem eht fI";
            string expected = "If the meanings of true and false were switched, this sentence wouldn't be false.";

            Assert.AreEquals(expected, Reverse.Reverse(reversed));
        }
Ejemplo n.º 2
0
        public static void Test01()
        {
            var type   = env.GetType("TestCase.Test01");
            var method = type.GetDeclaredMethod("Run2", null, null, env.String);

            Assert.AreEquals(method.Invoke(null), "Hello World!");
        }
Ejemplo n.º 3
0
        public static void Test01()
        {
            var type   = env.GetType("TestCase.Test01+TestClass");
            var method = type.GetDeclaredMethod("Calc", null, new ILType[] { env.GetType <int>() }, env.GetType <int>());

            Assert.AreEquals(method.Name, "Calc");
        }
Ejemplo n.º 4
0
        public static void Test01()
        {
            var type = env.GetType("TestCase.Test01");

            Assert.AreEquals(type.FullName, "TestCase.Test01");
            Assert.AreEquals(type.BaseType.TypeForCLR, typeof(object));
            Assert.AreSame(type.MakeArrayType(), env.GetType("TestCase.Test01[]"));
        }
Ejemplo n.º 5
0
        public void Test1()
        {
            int        testVal = 10;
            AccountObj obj     = new AccountObj(testVal, new AccountObjTestService());

            obj.RefreshAmount();
            Assert.AreEquals(obj.Amount, testVal);
        }
Ejemplo n.º 6
0
        public static void Test04()
        {
            var type = typeof(Dictionary <List <int>, int[, ]>);

            Assert.AreEquals(env.GetType(type).FullName, "System.Collections.Generic.Dictionary`2[System.Collections.Generic.List`1[System.Int32],System.Int32[,]]");
            Assert.AreEquals(env.GetType(type).FullQulifiedName, type.FullName);
            Assert.AreEquals(env.GetType(type).AssemblyQualifiedName, type.AssemblyQualifiedName);
            Assert.AreSame(env.GetType(type), env.GetType("System.Collections.Generic.Dictionary`2[System.Collections.Generic.List`1[System.Int32],System.Int32[,]]"));
            Assert.AreSame(env.GetType(type), env.GetType(typeof(Dictionary <,>)).MakeGenericType(typeof(List <int>), typeof(int[, ])));
        }
 public void Validate()
 {
     AddNotification(Assert.Length(_studentCommand.FirstName, 3, 40, "FirstName", "O nome deve conter entre 3 e 40 caracteres"));
     AddNotification(Assert.Length(_studentCommand.LastName, 3, 40, "LastName", "O sobrenome deve conter entre 3 e 40 caracteres"));
     AddNotification(Assert.Length(_studentCommand.Document, 11, 11, "Document", "CPF inválido"));
     AddNotification(Assert.EmailIsValid(_studentCommand.Email, "Email", "E-mail inválido"));
     AddNotification(Assert.Length(_userCommand.Username, 6, 20, "Username", "O usuário deve conter entre 6 e 20 caracteres"));
     AddNotification(Assert.Length(_userCommand.Password, 6, 20, "Password", "A senha deve conter entre 6 e 20 caracteres"));
     AddNotification(Assert.Length(_userCommand.ConfirmPassword, 6, 20, "ConfirmPassword", "A senha deve conter entre 6 e 20 caracteres"));
     AddNotification(Assert.AreEquals(_userCommand.Password, _userCommand.ConfirmPassword, "ConfirmPassword", "As senhas digitadas não coincidem"));
 }
Ejemplo n.º 8
0
        public static void Test03()
        {
            Action <ILType, Type> test = (ilType, clrType) =>
            {
                Assert.AreEquals(ilType.IsPublic, clrType.IsPublic);
                Assert.AreEquals(ilType.IsNestedPublic, clrType.IsNestedPublic);
                Assert.AreEquals(ilType.IsAbstract, clrType.IsAbstract);
                Assert.AreEquals(ilType.IsSealed, clrType.IsSealed);
            };

            test(env.GetType("TestCase.Test02+StructTest"), typeof(StructTest));
        }
        public void SumaDosNumeros()
        {
            // Arrange -> Preparacion
            var numero1  = 7;
            var numero2  = 10;
            var esperado = 17;

            // act -> Esta la parte de Ejecución
            var resultadoObtenido = sumar(numero1, numero2);

            // assert -> verificación
            Assert.AreEquals(esperado, resultadoObtenido);
        }
Ejemplo n.º 10
0
        public static void Test03()
        {
            var type = env.GetType(typeof(List <>));

            Assert.AreEquals(type.FullName, "System.Collections.Generic.List`1");
            Assert.AreEquals(type.FullQulifiedName, typeof(List <>).FullName);
            Assert.AreEquals(type.AssemblyQualifiedName, typeof(List <>).AssemblyQualifiedName);
            Assert.AreSame(type, env.GetType(typeof(List <>)));
            Assert.AreSame(type, env.GetType("System.Collections.Generic.List`1"));
            Assert.AreSame(type, env.GetType("System.Collections.Generic.List`1[System.Int32]").GenericTypeDefinition);
            Assert.AreSame(type.MakeGenericType(env.GetType(typeof(int))), env.GetType("System.Collections.Generic.List`1[[System.Int32, mscorlib]]"));
            Assert.AreSame(type.MakeGenericType(env.GetType(typeof(int))), env.GetType(typeof(List <int>)));
        }
Ejemplo n.º 11
0
        public static void Test02()
        {
            var type = env.GetType(typeof(int[][, ]));

            Assert.AreEquals(type.FullName, "System.Int32[,][]");
            Assert.AreEquals(type.AssemblyQualifiedName, typeof(int[][, ]).AssemblyQualifiedName);
            Assert.True(type.IsArray);
            Assert.AreEquals(type.ArrayRank, 1);
            Assert.AreSame(type, env.GetType("System.Int32[,][]"));
            Assert.AreSame(type, env.GetType("System.Int32[,][], mscorlib"));
            Assert.AreSame(type, env.GetType("System.Int32[,],mscorlib").MakeArrayType());
            Assert.AreSame(type, type.ElementType.MakeArrayType());
        }
Ejemplo n.º 12
0
        public static void BaseElementValidation(UIElement element)
        {
            Assert.IsTrue(element.Enabled);
            Assert.IsTrue(element.Displayed);
            Assert.IsFalse(element.Disabled);
            Assert.IsFalse(element.Hidden);
            var location = element.Location;

            Assert.IsTrue(location.X > 0 && location.Y > 0, "Location: " + location);
            var size = element.Size;

            Assert.IsTrue(size.Height > 0 && size.Width > 0, "Size: " + location);
            element.SetAttribute("test-jdi", "test-value");
            Assert.AreEquals(element.GetAttribute("test-jdi"), "test-value");
            element.Highlight("blue");
            element.Highlight();
            element.Show();
        }
Ejemplo n.º 13
0
        public static void Test01()
        {
            var type = env.GetType(typeof(int));

            Assert.AreEquals(type.FullName, "System.Int32");
            Assert.AreEquals(type.FullQulifiedName, "System.Int32");
            Assert.AreEquals(type.AssemblyQualifiedName, typeof(int).AssemblyQualifiedName);
            Assert.AreSame(type, env.GetType("System.Int32"));
            Assert.AreSame(type, env.GetType("System.Int32,mscorlib"));
            Assert.AreSame(type, env.GetType(typeof(int).AssemblyQualifiedName));
            Assert.False(type.IsArray);
            Assert.AreEquals(type.ArrayRank, 0);
            Assert.False(type.IsPointer);
            Assert.False(type.IsByRef);
            Assert.False(type.IsGenericTypeDefinition);
            Assert.False(type.IsGenericType);
            Assert.False(type.IsGenericParameter);
            Assert.Null(type.GenericTypeDefinition);
        }
Ejemplo n.º 14
0
 public static void CheckInitializedElement(this IBaseElement expectedParent, UIElement htmlElementToCheck, string expectedLocator, string expectedName, string expectedSmartLocator)
 {
     if (htmlElementToCheck != null)
     {
         if (htmlElementToCheck.Locator != null)
         {
             Assert.AreEquals(htmlElementToCheck.Locator.ToString(), expectedLocator);
         }
         else
         {
             Assert.AreEquals(htmlElementToCheck.SmartLocators[0].ToString(), expectedSmartLocator);
         }
         Assert.AreEquals(htmlElementToCheck.Parent, expectedParent);
         Assert.AreEquals(htmlElementToCheck.Name, expectedName);
     }
     else
     {
         throw new ArgumentNullException($"{expectedName} element is null.");
     }
 }
Ejemplo n.º 15
0
 public ColorAssert Color(string expectedColor)
 {
     Assert.AreEquals(ColorPicker.Color(), expectedColor);
     return(this);
 }
Ejemplo n.º 16
0
 public SelectAssert Size(int count)
 {
     Assert.AreEquals(count, _selector.Size());
     return(this);
 }
Ejemplo n.º 17
0
 public DropDownAssert Selected(Enum option)
 {
     Assert.AreEquals(option.ToString(), new SelectElement(DropDown).SelectedOption.Text);
     return(this);
 }
Ejemplo n.º 18
0
 public TableAssert Size(int expectedSize)
 {
     Assert.AreEquals(expectedSize, Table.TableSize);
     return(this);
 }
Ejemplo n.º 19
0
 public static void CheckText(Func <string> func, string expectedAttrValue)
 {
     Assert.AreEquals(func(), expectedAttrValue);
 }