Пример #1
0
        public void TestGetOnlineGivingProgramsForProgramType()
        {
            var programs = new List <MpProgram>
            {
                new MpProgram
                {
                    CommunicationTemplateId = 1,
                    Name        = "Program 1",
                    ProgramId   = 2,
                    ProgramType = 3
                },
                new MpProgram
                {
                    CommunicationTemplateId = 4,
                    Name        = "Program 2",
                    ProgramId   = 5,
                    ProgramType = 6
                },
            };

            _mpProgramService.Setup(mocked => mocked.GetOnlineGivingPrograms(3)).Returns(programs);

            var result = _fixture.GetOnlineGivingPrograms(3);

            _mpProgramService.VerifyAll();
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count);
            var expectedResult = programs.Select(Mapper.Map <ProgramDTO>).ToList();

            for (var i = 0; i < 2; i++)
            {
                Assert.AreEqual(expectedResult[i].ProgramType, result[i].ProgramType);
                Assert.AreEqual(expectedResult[i].CommunicationTemplateId, result[i].CommunicationTemplateId);
                Assert.AreEqual(expectedResult[i].Name, result[i].Name);
                Assert.AreEqual(expectedResult[i].ProgramId, result[i].ProgramId);
            }
        }