Beispiel #1
0
        public void WhenInvalidInListOfAll_IncludedInListOfGreaterThanWithMessage()
        {
            var allVersions = new List <Software>
            {
                new Software {
                    Name = "software1", Version = "abc"
                }
            };

            var softwares = softwareUtility.GetSoftwareGreaterThan(new Version("2.0.0"), allVersions);

            Assert.IsTrue(softwares.Any());
            Assert.AreEqual("software1", softwares.FirstOrDefault().Name);
            Assert.IsTrue(softwares.FirstOrDefault().Version.Contains("Invalid"));
        }
        public JsonResult GreaterSoftware([FromUri] SearchRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(new JsonResult(new List <Software>
                {
                    new Software {
                        Name = "Invalid", Version = "Input was not in correct format."
                    }
                }
                                      ));
            }

            var inputVersion = software.GetInputVersion(request.Input);

            return(new JsonResult(software.GetSoftwareGreaterThan(inputVersion, SoftwareManager.GetAllSoftware())));
        }