示例#1
0
        public void Serialize_Json()
        {
            string          name        = "TestName";
            string          description = "Test Description";
            SemanticVersion latest      = new SemanticVersion(1, 2, 3);
            List <PublicationSummaryModel> publications = new List <PublicationSummaryModel>()
            {
            };

            var uut = new PackageResultModel()
            {
                Name         = name,
                Description  = description,
                Latest       = latest,
                Publications = publications,
            };

            var json = TestUtils.JsonSerialize(uut);

            var expected =
                "{\"name\":\"TestName\"," +
                "\"description\":\"Test Description\"," +
                "\"latest\":\"1.2.3\"," +
                "\"publications\":[]}";

            Assert.Equal(expected, json);
        }
示例#2
0
        public void DefaultValues()
        {
            var uut = new PackageResultModel();

            Assert.Null(uut.Name);
            Assert.Null(uut.Description);
            Assert.Null(uut.Latest);
            Assert.Null(uut.Publications);
        }
示例#3
0
        public void InitializeValues()
        {
            string          name        = "TestName";
            string          description = "TestDescription";
            SemanticVersion latest      = new SemanticVersion(1, 0, 0);
            List <PublicationSummaryModel> publications = new List <PublicationSummaryModel>()
            {
            };

            var uut = new PackageResultModel()
            {
                Name         = name,
                Description  = description,
                Latest       = latest,
                Publications = publications,
            };

            Assert.Equal(name, uut.Name);
            Assert.Equal(description, uut.Description);
            Assert.Equal(latest, uut.Latest);
            Assert.Equal(publications, uut.Publications);
        }