Exemplo n.º 1
0
        static ApisJson GetExceptedApisJsonForServerNoSecurity()
        {
            var exceptedApisJsonForServerNoSecurity = new ApisJson
            {
                Name                 = EnvironmentVariables.PublicWebServerUri,
                Created              = DateTime.Today.Date,
                Modified             = DateTime.Today.Date,
                Description          = "",
                Url                  = EnvironmentVariables.PublicWebServerUri + "apis.json",
                SpecificationVersion = "0.15",
                Apis                 = new List <SingleApi>()
            };
            var singleApi1 = new SingleApi
            {
                Name        = "Hello World",
                Description = "",
                BaseUrl     = EnvironmentVariables.PublicWebServerUri + "secure/Hello World.json",
                Properties  = new List <PropertyApi>()
            };
            var swagger1 = new PropertyApi
            {
                Type  = "Swagger",
                Value = EnvironmentVariables.PublicWebServerUri + "secure/Hello World.api"
            };

            singleApi1.Properties.Add(swagger1);

            var singleApi2 = new SingleApi
            {
                Name        = "Execution Engine Test",
                Description = "",
                BaseUrl     = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/Execution Engine/Execution Engine Test.json",
                Properties  = new List <PropertyApi>()
            };
            var swagger2 = new PropertyApi
            {
                Type  = "Swagger",
                Value = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/Execution Engine/Execution Engine Test.api"
            };

            singleApi2.Properties.Add(swagger2);
            var singleApi3 = new SingleApi
            {
                Name        = "9139Local",
                Description = "",
                BaseUrl     = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/9139Local.json",
                Properties  = new List <PropertyApi>()
            };
            var swagger3 = new PropertyApi
            {
                Type  = "Swagger",
                Value = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/9139Local.api"
            };

            singleApi3.Properties.Add(swagger3);
            exceptedApisJsonForServerNoSecurity.Apis.Add(singleApi1);
            exceptedApisJsonForServerNoSecurity.Apis.Add(singleApi2);
            exceptedApisJsonForServerNoSecurity.Apis.Add(singleApi3);
            return(exceptedApisJsonForServerNoSecurity);
        }
Exemplo n.º 2
0
        static ApisJson GetExceptedApisJsonForServerPathWithNoSubDirectories()
        {
            var exceptedApisJsonForServerNoSecurity = new ApisJson
            {
                Name                 = EnvironmentVariables.PublicWebServerUri,
                Created              = DateTime.Today.Date,
                Modified             = DateTime.Today.Date,
                Description          = "",
                Url                  = EnvironmentVariables.PublicWebServerUri + "Acceptance Testing Resources/Execution Engine/apis.json",
                SpecificationVersion = "0.15",
                Apis                 = new List <SingleApi>()
            };

            var singleApi2 = new SingleApi
            {
                Name        = "Execution Engine Test",
                Description = "",
                BaseUrl     = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/Execution Engine/Execution Engine Test.json",
                Properties  = new List <PropertyApi>(),
                HumanUrl    = "https://warewolf.io",
                Image       = "https://warewolf.io/images/logo.png",
                Version     = "1.0",
                Tags        = new List <string>()
            };
            var swagger2 = new PropertyApi
            {
                Type  = "Swagger",
                Value = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/Execution Engine/Execution Engine Test.api"
            };

            singleApi2.Properties.Add(swagger2);

            exceptedApisJsonForServerNoSecurity.Apis.Add(singleApi2);
            return(exceptedApisJsonForServerNoSecurity);
        }
Exemplo n.º 3
0
        public void ApisJson_HashCode()
        {
            var id = new SingleApi();

            var ob1 = GetInstance(new List <SingleApi>(), new List <IncludeApi>(), new List <MaintainerApi>());

            Assert.AreNotEqual(0, ob1.GetHashCode());
        }
Exemplo n.º 4
0
        public void ApisJson_Equals_Null_IsFalse()
        {
            var id = new SingleApi();

            var ob1 = GetInstance(new List <SingleApi>(), new List <IncludeApi>(), new List <MaintainerApi>());

            Assert.IsFalse(ob1.Equals(null));
            Assert.IsFalse(ob1.Equals((object)null));
        }
Exemplo n.º 5
0
        public void ApisJson_SameEquals_IsTrue()
        {
            var id = new SingleApi();

            var ob1 = GetInstance(new List <SingleApi>(), new List <IncludeApi>(), new List <MaintainerApi>());

            Assert.IsTrue(ob1.Equals(ob1));
            Assert.IsTrue(ob1.Equals((object)ob1));
        }
Exemplo n.º 6
0
        public void ApisJson_Equals_IsFalse()
        {
            var id = new SingleApi();

            var ob1 = GetDefaultInstance();
            var ob2 = GetInstance(new List <SingleApi>(), new List <IncludeApi>(), new List <MaintainerApi>());

            Assert.IsFalse(ob1.Equals(ob2));
            Assert.IsFalse(ob1.Equals((object)ob2));
            Assert.IsFalse(ob1 == ob2);
            Assert.IsTrue(ob1 != ob2);
        }
Exemplo n.º 7
0
        SingleApi CreateSingleApiForResource(IResource resource, bool isPublic)
        {
            var webPath    = resource.GetResourcePath(GlobalConstants.ServerWorkspaceID).Replace("\\", "/");
            var accessPath = isPublic?"public/":"secure/";
            var singleApi  = new SingleApi
            {
                Name       = resource.ResourceName,
                BaseUrl    = EnvironmentVariables.PublicWebServerUri + accessPath + webPath + ".json",
                Properties = new List <PropertyApi>()
            };
            var propertyApi = new PropertyApi
            {
                Type  = "Swagger",
                Value = EnvironmentVariables.PublicWebServerUri + accessPath + webPath + ".api"
            };

            singleApi.Properties.Add(propertyApi);
            return(singleApi);
        }
Exemplo n.º 8
0
        SingleApi CreateSingleApiForResource(IResource resource,bool isPublic)
        {

            var webPath = resource.ResourcePath.Replace("\\","/");
            var accessPath = isPublic?"public/":"secure/";
            var singleApi = new SingleApi
            {
                Name = resource.ResourceName,
                BaseUrl = EnvironmentVariables.PublicWebServerUri + accessPath + webPath + ".json",
                Properties = new List<PropertyApi>()
            };
            var propertyApi = new PropertyApi
            {
                Type = "Swagger",
                Value = EnvironmentVariables.PublicWebServerUri + accessPath + webPath + ".api"
            };
            singleApi.Properties.Add(propertyApi);
            return singleApi;
        }
Exemplo n.º 9
0
        public void SingleApi_SetProperties_AreEqual_ToPropertyValue_ExpertTrue()
        {
            //----------------------Arrange-----------------------
            var contactTest = new MaintainerApi()
            {
                Fn       = "TestName TestLastName",
                Email    = "*****@*****.**",
                Url      = "https://warewolf.io",
                Org      = "https://dev2.co.za",
                Adr      = "Bellevue, Kloof",
                Tel      = "7777",
                XTwitter = "@warewolf",
                XGithub  = "Warewolf-ESB/Warewolf",
                Photo    = "https://warewolf.io/testimages/logo.png",
                VCard    = "39A03A58-978F-4CFB-B1D1-3EFA6C55E380"
            };
            var contactList = new List <MaintainerApi>();

            contactList.Add(contactTest);

            var propertyApi = new PropertyApi()
            {
                Type  = "TestType",
                Value = EnvironmentVariables.PublicWebServerUri + "secure/Hello World.api",
            };
            var propertyApisList = new List <PropertyApi>();

            propertyApisList.Add(propertyApi);

            var baseUrl     = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/Execution Engine/Execution Engine Test.json";
            var description = "TestDiscription";
            var humanUrl    = "https://warewolf.io";
            var image       = "https://warewolf.io/testimages/logo.png";
            var name        = "TestName";
            var tags        = new List <string>();
            var version     = "1.0.1.1";
            //----------------------Assert------------------------
            var singleApi = new SingleApi()
            {
                BaseUrl     = baseUrl,
                Contact     = contactList,
                Description = description,
                HumanUrl    = humanUrl,
                Image       = image,
                Name        = name,
                Properties  = propertyApisList,
                Tags        = tags,
                Version     = version,
            };

            //----------------------Act---------------------------
            Assert.AreEqual(baseUrl, singleApi.BaseUrl);
            Assert.AreEqual(contactList, singleApi.Contact);
            Assert.AreEqual(description, singleApi.Description);
            Assert.AreEqual(humanUrl, singleApi.HumanUrl);
            Assert.AreEqual(image, singleApi.Image);
            Assert.AreEqual(name, singleApi.Name);
            Assert.AreEqual(propertyApisList, singleApi.Properties);
            Assert.AreEqual(tags, singleApi.Tags);
            Assert.AreEqual(version, singleApi.Version);
        }
 static ApisJson GetExceptedApisJsonForServerPathWithNoSubDirectories()
 {
     var exceptedApisJsonForServerNoSecurity = new ApisJson
     {
         Name = EnvironmentVariables.PublicWebServerUri,
         Created = DateTime.Today.Date,
         Modified = DateTime.Today.Date,
         Description = "",
         Url = EnvironmentVariables.PublicWebServerUri + "Acceptance Testing Resources/Execution Engine/apis.json",
         SpecificationVersion = "0.15",
         Apis = new List<SingleApi>()
     };
     
     var singleApi2 = new SingleApi
     {
         Name = "Execution Engine Test",
         Description = "",
         BaseUrl = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/Execution Engine/Execution Engine Test.json",
         Properties = new List<PropertyApi>()
     };
     var swagger2 = new PropertyApi
     {
         Type = "Swagger",
         Value = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/Execution Engine/Execution Engine Test.api"
     };
     singleApi2.Properties.Add(swagger2);
     
     exceptedApisJsonForServerNoSecurity.Apis.Add(singleApi2);
     return exceptedApisJsonForServerNoSecurity;
 }
 static ApisJson GetExceptedApisJsonForServerSecurity()
 {
     var exceptedApisJsonForServerNoSecurity = new ApisJson
     {
         Name = EnvironmentVariables.PublicWebServerUri,
         Created = DateTime.Today.Date,
         Modified = DateTime.Today.Date,
         Description = "",
         Url = EnvironmentVariables.PublicWebServerUri + "apis.json",
         SpecificationVersion = "0.15",
         Apis = new List<SingleApi>()
     };
     var singleApi1 = new SingleApi
     {
         Name = "Hello World",
         Description = "",
         BaseUrl = EnvironmentVariables.PublicWebServerUri + "secure/Hello World.json",
         Properties = new List<PropertyApi>()
     };
     var swagger1 = new PropertyApi
     {
         Type = "Swagger",
         Value = EnvironmentVariables.PublicWebServerUri + "secure/Hello World.api"
     };
     singleApi1.Properties.Add(swagger1);
     
     var singleApi3 = new SingleApi
     {
         Name = "9139Local",
         Description = "",
         BaseUrl = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/9139Local.json",
         Properties = new List<PropertyApi>()
     };
     var swagger3 = new PropertyApi
     {
         Type = "Swagger",
         Value = EnvironmentVariables.PublicWebServerUri + "secure/Acceptance Testing Resources/9139Local.api"
     };
     singleApi3.Properties.Add(swagger3);
     exceptedApisJsonForServerNoSecurity.Apis.Add(singleApi1);
     exceptedApisJsonForServerNoSecurity.Apis.Add(singleApi3);
     return exceptedApisJsonForServerNoSecurity;
 }