예제 #1
0
        public void IsVisible_True()
        {
            MockCommandExecutor commandExec = new MockCommandExecutor();

            commandExec.SetBrowserInfo(new BrowserInfo()
            {
                Data = "<input id='button1' type='button' />"
            });
            _commandExecutorFactory.Setup(m => m.CreateBrowserCommandExecutor(It.IsAny <string>(), It.IsAny <HtmlPage>())).Returns(commandExec);
            var testPage = new HtmlPage();

            HtmlElement element = HtmlElement.Create("<input id='textbox1' type='textbox' />", testPage, false);

            UnitTestAssert.IsTrue(element.IsVisible());

            UnitTestAssert.AreEqual("GetElementAttributes", commandExec.ExecutedCommands[0].Handler.ClientFunctionName);
        }
예제 #2
0
        public void TestEnumModules()
        {
            StartHelloWorldAndBreak();

            var modules = ((Process3)VsIdeTestHostContext.Dte.Debugger.CurrentProcess).Modules;

            Assert.AreEqual(modules.Count, 1);
            var module     = modules.Item(1);
            var modulePath = module.Path;

            Assert.IsTrue(modulePath.EndsWith("Program.py"));
            Assert.AreEqual("Program", module.Name);
            Assert.AreEqual(module.Order, (uint)1);

            VsIdeTestHostContext.Dte.Debugger.TerminateAll();
            WaitForMode(dbgDebugMode.dbgDesignMode);
        }
예제 #3
0
        //[TestCase(typeof(MainUnitOfWork))]
        public void LevantaErroAoInformarNavigationPropertyInvalido(Type uowType)
        {
            TestInitialize(uowType);


            try
            {
                var niteroi = CidadeRepository.Selecionar(c => c.NomeCidade == "Niterói", joinWith: new[] { "Estado.Cidades.Estado.InvalidNavigationProperty", "Estado.Pais" });
                Assert.Fail("Não levantou erro ao fazer referência a um Navigation Property inválido.");
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is InvalidNavigationPropertyException, ex.Message);
                Assert.IsTrue((ex as InvalidNavigationPropertyException).InvalidNavigationProperty == "InvalidNavigationProperty");
                Assert.IsTrue((ex as InvalidNavigationPropertyException).Type == typeof(Modelo.Estado));
            }
        }
        public void TestDeserialize()
        {
            StudentInfo studentInfo = new StudentInfo
            {
                Id       = 1,
                Name     = "张三",
                BirthDay = new DateTime(2016, 9, 1, 9, 33, 10)
            };

            string json = studentInfo.ToJson("yyyy-MM-dd HH:mm:ss");

            StudentInfo student = json.JsonToObject <StudentInfo>();

            Assert.IsTrue(studentInfo.Id == student.Id);
            Assert.IsTrue(studentInfo.Name == student.Name);
            Assert.IsTrue(studentInfo.BirthDay == student.BirthDay);
        }
예제 #5
0
 public void Main_IfPOP3SaveToFileThrowsException_CallLogConsoleActivity()
 {
     //Arrange
     _testContext.POP3InboxMessageCountReturnValue = InboxMessageCount;
     ECN.engines.BounceEngine.msgsToProcess        = InboxMessageCount + 1;
     ECN.engines.BounceEngine.WriteMessageToFileIfWeCannotParseTheToAddress = true;
     _testContext.MimeMessageToAddresses.Add(MessageToInvalidEmailAddressBounceDomain);
     _testContext.MimeMessageFromAddress          = MessageFromEmailAddress;
     _testContext.MimeMessageDate                 = MessageDate;
     _testContext.POP3GetMessageAsTextReturnValue = "*****@*****.**";
     _testContext.POP3SaveToFileExceptionToThrow  = new Exception();
     //Act
     CalllBounceEngineMainMethod();
     //Assert
     Assert.IsTrue(_testContext.LogConsoleActivityCalled);
     Assert.IsTrue(_testContext.BounceEngineDeleteMessageWithCheckCalled);
 }
예제 #6
0
        public void Main_IfToEmailInvalidAndHasBounceDomainAndWriteCannotPareToAddressTrue_CallPOP3SaveToFile()
        {
            //Arrange
            ECN.engines.BounceEngine.WriteMessageToFileIfWeCannotParseTheToAddress = true;
            _testContext.POP3InboxMessageCountReturnValue = InboxMessageCount;
            ECN.engines.BounceEngine.msgsToProcess        = InboxMessageCount + 1;
            _testContext.MimeMessageToAddresses.Add(MessageToInvalidEmailAddressBounceDomain);
            _testContext.MimeMessageFromAddress          = MessageFromEmailAddress;
            _testContext.MimeMessageDate                 = MessageDate;
            _testContext.POP3GetMessageAsTextReturnValue = TextMessageOurEmail;
            //Act
            CalllBounceEngineMainMethod();

            //Assert
            Assert.IsTrue(_testContext.POP3SaveToFileCalled);
            Assert.IsTrue(_testContext.BounceEngineDeleteMessageWithCheckCalled);
        }
예제 #7
0
        public void Main_IfArgumentExceptionThronw_LogConsoleActivity()
        {
            //Arrange
            _testContext.POP3InboxMessageCountReturnValue = InboxMessageCount;
            ECN.engines.BounceEngine.msgsToProcess        = InboxMessageCount + 1;
            _testContext.MimeMessageToAddresses.Add(MessageToEmailAddress);
            _testContext.MimeMessageFromAddress          = MessageFromEmailAddress;
            _testContext.MimeMessageDate                 = MessageDate;
            _testContext.POP3GetMessageAsTextReturnValue = string.Empty;
            _testContext.POP3IsConnectedExceptionToThrow = new ArgumentException();

            //Act
            CalllBounceEngineMainMethod();

            //Assert
            Assert.IsTrue(_testContext.LogConsoleActivityCalled);
        }
예제 #8
0
        public void Main_IfDeleteNoneBounceIsTrueAndToEmailNotContainedInBounceDomains_ShouldCallDeleteMessageWithCheck()
        {
            //Arrange
            _testContext.POP3InboxMessageCountReturnValue = InboxMessageCount;
            ECN.engines.BounceEngine.msgsToProcess        = InboxMessageCount + 1;
            _testContext.MimeMessageToAddresses.Add(MessageToEmailAddress);
            _testContext.MimeMessageFromAddress          = MessageFromEmailAddress;
            _testContext.MimeMessageDate                 = MessageDate;
            _testContext.POP3GetMessageAsTextReturnValue = string.Empty;
            _testContext.DeleteNonBouncesReturnValue     = true;

            //Act
            CalllBounceEngineMainMethod();

            //Assert
            Assert.IsTrue(_testContext.BounceEngineDeleteMessageWithCheckCalled);
        }
예제 #9
0
        public void PersistContentTest()
        {
            _listTest.Add(new FieldConfig
            {
                Name      = "Test 2",
                IsVisible = false,
                Required  = false
            });

            RunBeforeTests(_listTest);

            var fileManager     = new JsonFileManager();
            var resultingObject = fileManager.LoadContentAs <IEnumerable <FieldConfig> >(FilePath);
            var fieldConfigs    = resultingObject.ToList();

            Assert.IsTrue(fieldConfigs.Count == 2);
        }
예제 #10
0
        public void ExecuteDeleteTest()
        {
            var query = new Query <Album>()
            {
                QueryType  = QueryType.Write,
                ActionType = ActionType.Delete,
                Keys       = new List <int>()
                {
                    1,
                }
            };

            var data = storage.Execute(query);

            storage.Commit();

            Assert.IsTrue(data.IsSuccess);
        }
예제 #11
0
        public void Main_IfToEmailValidAndHasValidBounceDomainAndDateTimeIsInvalid_CallPOP3SavtToFile()
        {
            //Arrange
            var invalidDate = DateTime.MinValue.ToString();

            _testContext.POP3InboxMessageCountReturnValue = InboxMessageCount;
            ECN.engines.BounceEngine.msgsToProcess        = InboxMessageCount + 1;
            _testContext.MimeMessageToAddresses.Add(MessageToValidEmailAddressBounceDomain);
            _testContext.MimeMessageFromAddress          = MessageFromEmailAddress;
            _testContext.MimeMessageDate                 = invalidDate;
            _testContext.POP3GetMessageAsTextReturnValue = "*****@*****.**";

            //Act
            CalllBounceEngineMainMethod();

            //Assert
            Assert.IsTrue(_testContext.POP3SaveToFileCalled);
        }
예제 #12
0
        public void Main_IfToEmailValidAndHasValidBounceDomainAndFileExists_CallFileDelete()
        {
            //Arrange
            _testContext.POP3InboxMessageCountReturnValue = InboxMessageCount;
            ECN.engines.BounceEngine.msgsToProcess        = InboxMessageCount + 1;
            _testContext.MimeMessageToAddresses.Add(MessageToValidEmailAddressBounceDomain);
            _testContext.MimeMessageFromAddress          = MessageFromEmailAddress;
            _testContext.MimeMessageDate                 = MessageDate;
            _testContext.POP3GetMessageAsTextReturnValue = "*****@*****.**";
            _testContext.FileExistsPathToReturnTrue      = "BOUNCE_EMAIL_";

            //Act
            CalllBounceEngineMainMethod();

            //Assert
            Assert.IsTrue(_testContext.FileDeleteCalled);
            Assert.IsTrue(_testContext.POP3SaveToFileCalled);
        }