public void ExecuteOperation_Test() { //Arrange var input = BuildOperationInput(); var connectionInfo = new Dictionary<string, string>(); connectionInfo.Add("AccessToken", "1234"); connectionInfo.Add("OrganizerKey", "56789"); //use a Mock GoToWebinarClient. We're not testing the actual call, but the Operation Code: var webinarClient = new Mock<IGoToWebinarClient>(); var operationProcessor = new OperationProcessor(webinarClient.Object, connectionInfo); var entity = BuildEntity(); webinarClient.Setup(method => method.CreateRegistrant("1234", "56789", "1235813", "Joe", "Josephs", "*****@*****.**")).Returns(entity); //Act var operationResult = operationProcessor.ExecuteOperation(input); //Assert: Assert.AreEqual(2, operationResult.Success.Where(result => result == true).Count()); Assert.IsTrue(operationResult.Output.Any(data => data.ObjectDefinitionFullName == "Registrant")); }
public void ExecuteOperation_TestFailure() { //Arrange var input = BuildOperationInput(); var connectionInfo = new Dictionary<string, string>(); connectionInfo.Add("AccessToken", "1234"); connectionInfo.Add("OrganizerKey", "56789"); //use a Mock GoToWebinarClient. We're not testing the actual call, but the Operation Code: var webinarClient = new Mock<IGoToWebinarClient>(); //have 'bob' throw an exception: webinarClient.Setup(method => method.CreateRegistrant("1234", "56789", "1235813", "Bob", "Roberts", "*****@*****.**")).Throws<System.Net.WebException>(); var operationProcessor = new OperationProcessor(webinarClient.Object, connectionInfo); //Act var operationResult = operationProcessor.ExecuteOperation(input); //Assert: Assert.AreEqual(1, operationResult.Success.Where(result => result == true).Count()); Assert.AreEqual(1, operationResult.Success.Where(result => result == false).Count()); }
public void ExecuteOperation_TestFailure() { //Arrange var input = BuildOperationInput(); var connectionInfo = new Dictionary <string, string>(); connectionInfo.Add("AccessToken", "1234"); connectionInfo.Add("OrganizerKey", "56789"); //use a Mock GoToWebinarClient. We're not testing the actual call, but the Operation Code: var webinarClient = new Mock <IGoToWebinarClient>(); //have 'bob' throw an exception: webinarClient.Setup(method => method.CreateRegistrant("1234", "56789", "1235813", "Bob", "Roberts", "*****@*****.**")).Throws <System.Net.WebException>(); var operationProcessor = new OperationProcessor(webinarClient.Object, connectionInfo); //Act var operationResult = operationProcessor.ExecuteOperation(input); //Assert: Assert.AreEqual(1, operationResult.Success.Where(result => result == true).Count()); Assert.AreEqual(1, operationResult.Success.Where(result => result == false).Count()); }
public void ExecuteOperation_Test() { //Arrange var input = BuildOperationInput(); var connectionInfo = new Dictionary <string, string>(); connectionInfo.Add("AccessToken", "1234"); connectionInfo.Add("OrganizerKey", "56789"); //use a Mock GoToWebinarClient. We're not testing the actual call, but the Operation Code: var webinarClient = new Mock <IGoToWebinarClient>(); var operationProcessor = new OperationProcessor(webinarClient.Object, connectionInfo); var entity = BuildEntity(); webinarClient.Setup(method => method.CreateRegistrant("1234", "56789", "1235813", "Joe", "Josephs", "*****@*****.**")).Returns(entity); //Act var operationResult = operationProcessor.ExecuteOperation(input); //Assert: Assert.AreEqual(2, operationResult.Success.Where(result => result == true).Count()); Assert.IsTrue(operationResult.Output.Any(data => data.ObjectDefinitionFullName == "Registrant")); }