public void DevOpsManager_Associate_TestMethodsNotAvailableCountIsNotEqualToZero() { // Arrange var outputManagerMock = new Mock <IOutputManager>(); var devOpsAccessMock = new Mock <IDevOpsAccess>(); var fixture = new Fixture(); var methods = fixture.Create <TestMethod[]>(); var testCases = fixture.Create <TestCase[]>(); var testMethodsNotAvailable = fixture.Create <List <TestCase> >(); devOpsAccessMock.Setup(x => x.ListTestCasesWithNotAvailableTestMethods(It.IsAny <TestMethod[]>(), It.IsAny <TestCase[]>())).Returns(testMethodsNotAvailable); devOpsAccessMock.Setup(x => x.Associate(It.IsAny <TestMethod[]>(), It.IsAny <Dictionary <string, TestCase> >())).Returns(0); var counter = new Counter(); var target = new DevOpsManagerFactory(devOpsAccessMock.Object, outputManagerMock.Object, counter).Create(); // Act Action actual = () => target.Associate(methods, testCases); // Assert actual.Should().NotThrow(); outputManagerMock.Verify(x => x.WriteToConsole(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(DefaultWriteCount + testMethodsNotAvailable.Count)); }
public void Program_Associate_TestMethodsNotAvailableCountIsNotEqualToZero() { // Arrange var devOpsAccessMock = new Mock <IDevOpsAccess>(); var outputAccessMock = new Mock <IOutputAccess>(); var outputManagerMock = new Mock <IOutputManager>(); var testCaseAccessMock = new Mock <ITestCaseAccess>(); const bool validateOnly = true; var fixture = new Fixture(); var testType = string.Empty; var messages = new Messages(); var methods = new MethodInfo[] { GetType().GetMethod(MethodBase.GetCurrentMethod().Name), GetType().GetMethod(MethodBase.GetCurrentMethod().Name), GetType().GetMethod(MethodBase.GetCurrentMethod().Name) }; var testCases = fixture.Create <List <TestCase> >(); var testMethodsNotAvailable = fixture.Create <List <TestCase> >(); devOpsAccessMock.Setup(x => x.ListTestCasesWithNotAvailableTestMethods(It.IsAny <List <TestCase> >(), It.IsAny <List <TestMethod> >())).Returns(testMethodsNotAvailable); devOpsAccessMock.Setup(x => x.Associate(It.IsAny <List <TestMethod> >(), It.IsAny <List <TestCase> >(), It.IsAny <ITestCaseAccess>(), It.IsAny <bool>(), It.IsAny <string>())).Returns(0); var counter = new Counter(); var target = new DevOpsManagerFactory(devOpsAccessMock.Object, outputManagerMock.Object, outputAccessMock.Object, testCaseAccessMock.Object, counter, messages).Create(); // Act Action actual = () => target.Associate(methods, testCases, validateOnly, testType); // Assert actual.Should().NotThrow <InvalidOperationException>(); outputAccessMock.Verify(x => x.WriteToConsole(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(DefaultWriteCount + testMethodsNotAvailable.Count)); }