public void ReloadTestsExecute_NullValues_ErrorResult() { //------------Setup for test-------------------------- var deleteTest = new ReloadTests(); var repo = new Mock <ITestCatalog>(); repo.Setup(catalog => catalog.Load()).Throws(new Exception()); deleteTest.TestCatalog = repo.Object; var serializer = new Dev2JsonSerializer(); //------------Execute Test--------------------------- var jsonResult = deleteTest.Execute(null, null); var result = serializer.Deserialize <CompressedExecuteMessage>(jsonResult); //------------Assert Results------------------------- Assert.IsTrue(result.HasError); }
public void ReloadTestsExecute__ValidArgs_ExpectDeleteTestCalled() { //------------Setup for test-------------------------- var deleteTest = new ReloadTests(); var repo = new Mock <ITestCatalog>(); var ws = new Mock <IWorkspace>(); repo.Setup(a => a.Load()).Verifiable(); deleteTest.TestCatalog = repo.Object; //------------Execute Test--------------------------- deleteTest.Execute(new Dictionary <string, StringBuilder>(), ws.Object); //------------Assert Results------------------------- repo.Verify(a => a.Load(), Times.Once); }