Beispiel #1
0
        public void test_repositoryFactory_MockUsage()
        {
            var surveys = new List <Survey>
            {
                new Survey
                {
                    SurveyId    = Guid.Parse("DCDB4463-7918-49CD-9C78-4421A6731FB4"),
                    Title       = "Suver 1",
                    Description = "The first survey"
                },
                new Survey
                {
                    SurveyId    = Guid.Parse("3BA55396-C3C0-40CE-BD91-E069A928A21A"),
                    Title       = "Suver 2",
                    Description = "The second survey"
                }
            };

            var dataRepositoryMock = new Mock <IDataRepositoryFactory>();

            dataRepositoryMock.Setup(obj => obj.GetDataRepository <ISurveyRepository>().Get()).Returns(surveys);

            var rftc   = new RepositoryFactoryTestClass(dataRepositoryMock.Object);
            var result = rftc.GetSurveys();

            Assert.IsTrue(Equals(result, surveys), "List from repository does not match the class passed into the mock ");
        }
Beispiel #2
0
        public void test_repositoryFactory_IntegrationUsage()
        {
            var rtc     = new RepositoryFactoryTestClass();
            var surveys = rtc.GetSurveys();

            Assert.IsTrue(surveys != null, "Returned Surveys is null");
        }