public void FetchAllTests_Execute_ExpectTestList()
        {
            //------------Setup for test--------------------------
            var fetchAllTests = new FetchAllTests();

            var listOfTests = new List <IServiceTestModelTO>
            {
                new ServiceTestModelTO
                {
                    AuthenticationType = AuthenticationType.Public,
                    Enabled            = true,
                    TestName           = "Test MyWF"
                }
            };
            var repo  = new Mock <ITestCatalog>();
            var ws    = new Mock <IWorkspace>();
            var resID = Guid.Empty;

            repo.Setup(a => a.FetchAllTests()).Returns(listOfTests).Verifiable();

            var serializer = new Dev2JsonSerializer();

            fetchAllTests.TestCatalog = repo.Object;
            //------------Execute Test---------------------------
            var res        = fetchAllTests.Execute(null, ws.Object);
            var msg        = serializer.Deserialize <CompressedExecuteMessage>(res);
            var testModels = serializer.Deserialize <List <IServiceTestModelTO> >(msg.GetDecompressedMessage());

            //------------Assert Results-------------------------
            repo.Verify(a => a.FetchAllTests());
            Assert.AreEqual(listOfTests.Count, testModels.Count);
            Assert.AreEqual(listOfTests[0].TestName, testModels[0].TestName);
        }
        public void FetchTests_Execute_NullValues_ErrorResult()
        {
            //------------Setup for test--------------------------
            var fetchAllTests = new FetchAllTests();
            var serializer    = new Dev2JsonSerializer();
            //------------Execute Test---------------------------
            var jsonResult = fetchAllTests.Execute(null, null);
            var result     = serializer.Deserialize <CompressedExecuteMessage>(jsonResult);

            //------------Assert Results-------------------------
            Assert.IsFalse(result.HasError);
        }
        public void FetchTests_Execute_ResourceIDNotGuid_ErrorResult()
        {
            //------------Setup for test--------------------------
            var values = new Dictionary <string, StringBuilder> {
                { "resourceID", new StringBuilder("ABCDE") }
            };
            var fetchAllTests = new FetchAllTests();
            var serializer    = new Dev2JsonSerializer();
            //------------Execute Test---------------------------
            var jsonResult = fetchAllTests.Execute(values, null);
            var result     = serializer.Deserialize <CompressedExecuteMessage>(jsonResult);

            //------------Assert Results-------------------------
            Assert.IsFalse(result.HasError);
        }