Esempio n. 1
0
        public void FetchTests_Execute_NullValues_ErrorResult()
        {
            //------------Setup for test--------------------------
            var fetchTests = new FetchTests();
            var serializer = new Dev2JsonSerializer();
            //------------Execute Test---------------------------
            var jsonResult = fetchTests.Execute(null, null);
            var result     = serializer.Deserialize <CompressedExecuteMessage>(jsonResult);

            //------------Assert Results-------------------------
            Assert.IsTrue(result.HasError);
        }
Esempio n. 2
0
        public void FetchTests_Execute_ResourceIDNotGuid_ErrorResult()
        {
            //------------Setup for test--------------------------
            var values = new Dictionary <string, StringBuilder> {
                { "resourceID", new StringBuilder("ABCDE") }
            };
            var fetchTests = new FetchTests();
            var serializer = new Dev2JsonSerializer();
            //------------Execute Test---------------------------
            var jsonResult = fetchTests.Execute(values, null);
            var result     = serializer.Deserialize <CompressedExecuteMessage>(jsonResult);

            //------------Assert Results-------------------------
            Assert.IsTrue(result.HasError);
        }
Esempio n. 3
0
        public void FetchTests_Execute_ExpectTestList()
        {
            //------------Setup for test--------------------------
            var fetchTests = new FetchTests();

            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.Fetch(It.IsAny <Guid>())).Callback((Guid id) =>
            {
                resID = id;
            }).Returns(listOfTests).Verifiable();

            var serializer = new Dev2JsonSerializer();
            var inputs     = new Dictionary <string, StringBuilder>();
            var resourceID = Guid.NewGuid();

            inputs.Add("resourceID", new StringBuilder(resourceID.ToString()));
            fetchTests.TestCatalog = repo.Object;
            //------------Execute Test---------------------------
            var res        = fetchTests.Execute(inputs, ws.Object);
            var msg        = serializer.Deserialize <CompressedExecuteMessage>(res);
            var testModels = serializer.Deserialize <List <IServiceTestModelTO> >(msg.GetDecompressedMessage());

            //------------Assert Results-------------------------
            repo.Verify(a => a.Fetch(It.IsAny <Guid>()));
            Assert.AreEqual(listOfTests.Count, testModels.Count);
            Assert.AreEqual(listOfTests[0].TestName, testModels[0].TestName);
            Assert.AreEqual(resourceID, resID);
        }