public void FindOptions_Execute_SelectedSourceId_RabbitMq_ShouldHaveOptions() { //------------Setup for test------------------------- var mockResourceCatalog = new Mock <IResourceCatalog>(); var mockRabbitMqSource = new Mock <IResource>(); mockRabbitMqSource.Setup(rr => rr.ResourceType).Returns(enSourceType.RabbitMQSource.ToString()); mockResourceCatalog.Setup(r => r.GetResource(It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(mockRabbitMqSource.Object); var findOptions = new FindOptions(); findOptions.ResourceCatalog = mockResourceCatalog.Object; var workspaceMock = new Mock <IWorkspace>(); //------------Execute Test--------------------------- var requestArgs = new Dictionary <string, StringBuilder> { { "SelectedSourceId", Guid.NewGuid().ToString().ToStringBuilder() } }; var executeResults = findOptions.Execute(requestArgs, workspaceMock.Object); var jsonSerializer = new Dev2JsonSerializer(); Assert.IsNotNull(executeResults); var deserializedResults = jsonSerializer.Deserialize <List <IOption> >(executeResults); //------------Assert Results------------------------- Assert.IsNotNull(deserializedResults); Assert.AreEqual(1, deserializedResults.Count); Assert.AreEqual("Durable", deserializedResults[0].Name); Assert.IsInstanceOfType(deserializedResults[0], typeof(OptionBool)); }
public void FindOptions_GivenNullArgs_Returns_InvalidDataContractException() { //------------Setup for test------------------------- var findOptions = new FindOptions(); var workspaceMock = new Mock <IWorkspace>(); //------------Execute Test--------------------------- findOptions.Execute(null, workspaceMock.Object); }
public void FindOptions_GivenEmptyArgs_Returns_ArgumentNullException() { //------------Setup for test------------------------- var findOptions = new FindOptions(); var workspaceMock = new Mock <IWorkspace>(); //------------Execute Test--------------------------- var requestArgs = new Dictionary <string, StringBuilder>(); findOptions.Execute(requestArgs, workspaceMock.Object); }