void FindResourcesByID(int expectedCount, params string[] guids) { var workspace = new Mock <IWorkspace>(); workspace.Setup(m => m.ID).Returns(_workspaceID); IEsbManagementEndpoint findResourcesEndPoint = new FindResourcesByID(); Dictionary <string, StringBuilder> data = new Dictionary <string, StringBuilder>(); data["GuidCsv"] = new StringBuilder(string.Join(",", guids)); data["ResourceType"] = new StringBuilder("Source"); var resources = findResourcesEndPoint.Execute(data, workspace.Object); var resourcesObj = JsonConvert.DeserializeObject <List <Resource> >(resources.ToString()); var actualCount = 0; // ReSharper disable LoopCanBeConvertedToQuery foreach (var res in resourcesObj) // ReSharper restore LoopCanBeConvertedToQuery { if (res.ResourceType == ResourceType.DbSource || res.ResourceType == ResourceType.PluginSource || res.ResourceType == ResourceType.WebSource || res.ResourceType == ResourceType.EmailSource || res.ResourceType == ResourceType.Server) { actualCount++; } } Assert.AreEqual(expectedCount, actualCount); }
// ReSharper disable InconsistentNaming public void FindResourcesByID_With_NullTypeParameter_Expected_ThrowsArgumentNullException() { var workspace = new Mock <IWorkspace>(); workspace.Setup(m => m.ID).Returns(TestWorkspaceID); IEsbManagementEndpoint endpoint = new FindResourcesByID(); Dictionary <string, StringBuilder> data = new Dictionary <string, StringBuilder>(); data["GuidCsv"] = null; data["Type"] = null; endpoint.Execute(data, workspace.Object); }