public void Initialize()
        {
            Mock <IAdditionalDemographicRuleEngine> mock = new Mock <IAdditionalDemographicRuleEngine>();

            additionalDemographicRuleEngine = mock.Object;

            additionalDemographicController = new AdditionalDemographicController(additionalDemographicRuleEngine);

            var additionalDemographics = new List <AdditionalDemographicsModel>();

            additionalDemographics.Add(new AdditionalDemographicsModel()
            {
                ContactID   = 1,
                Name        = "Joe Smith",
                MRN         = 123456,
                EthnicityID = 1
            });
            additionalDemographics.Add(new AdditionalDemographicsModel()
            {
                ContactID   = 2,
                Name        = "Joe Smith",
                MRN         = 123456,
                EthnicityID = 1
            });
            additionalDemographics.Add(new AdditionalDemographicsModel()
            {
                ContactID   = 3,
                Name        = "Joe Smith",
                MRN         = 123456,
                EthnicityID = 1
            });

            var alladditionalDemography = new Response <AdditionalDemographicsModel>()
            {
                DataItems = additionalDemographics
            };

            //Get Additional Demographic
            Response <AdditionalDemographicsModel> additionalDemographicResponse = new Response <AdditionalDemographicsModel>();

            additionalDemographicResponse.DataItems = additionalDemographics.Where(x => x.ContactID == contactId).ToList();

            mock.Setup(r => r.GetAdditionalDemographic(It.IsAny <long>()))
            .Returns(additionalDemographicResponse);

            //Add AdditionalDemographic
            mock.Setup(r => r.AddAdditionalDemographic(It.IsAny <AdditionalDemographicsModel>()))
            .Callback((AdditionalDemographicsModel additionalDemographicsModel) => additionalDemographics.Add(additionalDemographicsModel))
            .Returns(alladditionalDemography);

            //Update AdditionalDemographic
            mock.Setup(r => r.UpdateAdditionalDemographic(It.IsAny <AdditionalDemographicsModel>()))
            .Callback((AdditionalDemographicsModel additionalDemographicsModel) => additionalDemographics.Add(additionalDemographicsModel))
            .Returns(alladditionalDemography);
        }
Esempio n. 2
0
 public void Initialize()
 {
     // Arrange
     controller = new AdditionalDemographicController(new AdditionalDemographicRepository(ConfigurationManager.AppSettings["UnitTestToken"]));
 }
Esempio n. 3
0
        public void Initialize()
        {
            Mock <IAdditionalDemographicDataProvider> mock = new Mock <IAdditionalDemographicDataProvider>();

            additionalDemographicDataProvider = mock.Object;

            additionalDemographicController = new AdditionalDemographicController(additionalDemographicDataProvider);

            var additionalDemographics = new List <AdditionalDemographicsModel>();

            additionalDemographics.Add(new AdditionalDemographicsModel()
            {
                ContactID   = 1,
                Name        = "Joe Smith",
                MRN         = 123456,
                EthnicityID = 1
            });
            additionalDemographics.Add(new AdditionalDemographicsModel()
            {
                ContactID   = 2,
                Name        = "Joe Smith",
                MRN         = 123456,
                EthnicityID = 1
            });
            additionalDemographics.Add(new AdditionalDemographicsModel()
            {
                ContactID   = 3,
                Name        = "Joe Smith",
                MRN         = 123456,
                EthnicityID = 1
            });

            var alladditionalDemography = new Response <AdditionalDemographicsModel>()
            {
                DataItems   = additionalDemographics,
                RowAffected = 1
            };

            //Get AdditionalDemographic
            Response <AdditionalDemographicsModel> additionalDemographicResponse = new Response <AdditionalDemographicsModel>();

            additionalDemographicResponse.DataItems   = additionalDemographics.Where(contact => contact.ContactID == contactId).ToList();
            additionalDemographicResponse.RowAffected = 1;


            mock.Setup(r => r.GetAdditionalDemographic(It.IsAny <long>()))
            .Returns(additionalDemographicResponse);

            //Add AdditionalDemographic
            mock.Setup(r => r.AddAdditionalDemographic(It.IsAny <AdditionalDemographicsModel>()))
            .Callback((AdditionalDemographicsModel additionalDemographicsModel) => additionalDemographics.Add(additionalDemographicsModel))
            .Returns(additionalDemographicResponse);

            //Update AdditionalDemographic
            mock.Setup(r => r.UpdateAdditionalDemographic(It.IsAny <AdditionalDemographicsModel>()))
            .Callback((AdditionalDemographicsModel additionalDemographicsModel) => additionalDemographics.Add(additionalDemographicsModel))
            .Returns(additionalDemographicResponse);

            //Delete
            mock.Setup(r => r.DeleteAdditionalDemographic(It.IsAny <long>(), DateTime.UtcNow))
            .Returns(additionalDemographicResponse);
        }