Beispiel #1
0
        public async Task Post_University_Success()
        {
            var uni = new University
            {
                Name   = "UIUC",
                Domain = "illinois.edu"
            };

            var result = await _controller.PostUniversity(uni);

            Assert.IsType <CreatedAtActionResult>(result.Result);

            Assert.Single(_context.Universities.ToList());
            Assert.Equal(uni, _context.Universities.ToList()[0]);
        }
        public async Task Post_University()
        {
            University test_university = new University()
            {
                Id     = "1002",
                Name   = "UIC",
                Domain = "illinois.edu"
            };

            var result = await _controller.PostUniversity(test_university);

            var return_university = Assert.IsType <University>(result.Value);

            Assert.Equal(test_university.Id, return_university.Id);
            Assert.Equal(test_university.Name, return_university.Name);
            Assert.Equal(test_university.Domain, return_university.Domain);
        }