Пример #1
0
        public void CompoundControllerGetAll_ReturnsListOfCompoundDtos()
        {
            //Arrange
            var controller = new CompoundController();

            //Act
            var result = controller.GetAll();

            //Assert
            Assert.AreEqual(typeof(OkNegotiatedContentResult <List <CompoundDto> >), result.GetType());
            Assert.IsTrue(((OkNegotiatedContentResult <List <CompoundDto> >)result).Content.Count > 0);
        }
Пример #2
0
        public void CompoundControllerGetEdit_ReturnsMappedElementList()
        {
            //Arrange
            var controller = new CompoundController();

            //Act
            var compoundJson = controller.GetAll() as JsonResult;
            var serializer   = new JavaScriptSerializer();

            var compounds  = serializer.Deserialize <List <CompoundDto> >(serializer.Serialize(compoundJson.Data));
            var compoundId = compounds.First().Id;

            var result = controller.Edit(compoundId) as ViewResult;
            var model  = (CompoundElementPartialDto)result.Model;

            //Assert
            Assert.IsNotNull(model);
            Assert.IsTrue(model.Elements.Count > 0);
        }