Ejemplo n.º 1
0
 public void SetUp()
 {
     autoMocker = new RhinoAutoMocker<VotableFeatureVoter>(MockMode.AAA);
     expectedVotableFeature = new VotableFeature
     {
         NumberOfDownvotes = startingNumberOfDownvotes,
         NumberOfUpvotes = startingNumberOfUpvotes
     };
     autoMocker.Get<IDataContext>().Expect(mock => mock.FindById<VotableFeature>(votableFeatureId))
               .Return(expectedVotableFeature);
 }
Ejemplo n.º 2
0
 public void SetUp()
 {
     autoMocker             = new RhinoAutoMocker <VotableFeatureVoter>(MockMode.AAA);
     expectedVotableFeature = new VotableFeature
     {
         NumberOfDownvotes = startingNumberOfDownvotes,
         NumberOfUpvotes   = startingNumberOfUpvotes
     };
     autoMocker.Get <IDataContext>().Expect(mock => mock.FindById <VotableFeature>(votableFeatureId))
     .Return(expectedVotableFeature);
 }
        public void ItRetrievesTheGivenVotableFeature()
        {
            string featureId = "some feature id";
            VotableFeature expectedVotableFeature = new VotableFeature();
            autoMocker.Get<IDataContext>().Expect(mock => mock.FindById<VotableFeature>(featureId))
                .Return(expectedVotableFeature);

            var actualResult = autoMocker.ClassUnderTest.RetrieveVotableFeature(featureId);

            Assert.That(expectedVotableFeature, Is.SameAs(actualResult));
        }
Ejemplo n.º 4
0
 // GET /api/VotableFeatures/<id>
 public VotableFeatureViewModel Get(string id)
 {
     try
     {
         VotableFeature votableFeature = votableFeatureRetriever.RetrieveVotableFeature(id);
         return(Mapper.Map <VotableFeature, VotableFeatureViewModel>(votableFeature));
     }
     catch (EntityDoesNotExistException)
     {
         throw new HttpResponseException(HttpStatusCode.NotFound);
     }
 }
Ejemplo n.º 5
0
        public void ItRetrievesTheGivenVotableFeature()
        {
            string         featureId = "some feature id";
            VotableFeature expectedVotableFeature = new VotableFeature();

            autoMocker.Get <IDataContext>().Expect(mock => mock.FindById <VotableFeature>(featureId))
            .Return(expectedVotableFeature);

            var actualResult = autoMocker.ClassUnderTest.RetrieveVotableFeature(featureId);

            Assert.That(expectedVotableFeature, Is.SameAs(actualResult));
        }
        public void Get_ReturnsTheFeatureInterestSummaryForTheGivenFeature()
        {
            string featureId = "some feature id";
            VotableFeature expectedVotableFeature = new VotableFeature()
            {
                Id = featureId
            };
            autoMocker.Get<IVotableFeatureRetriever>().Expect(mock => mock.RetrieveVotableFeature(featureId))
                      .Return(expectedVotableFeature);
            VotableFeatureViewModel expectedVotableFeatureViewModel = Mapper.Map<VotableFeature, VotableFeatureViewModel>(expectedVotableFeature);

            autoMocker.ClassUnderTest.Get(featureId);

            Assert.That(expectedVotableFeatureViewModel.Id, Is.EqualTo(featureId));
        }
        public void Get_ReturnsTheFeatureInterestSummaryForTheGivenFeature()
        {
            string         featureId = "some feature id";
            VotableFeature expectedVotableFeature = new VotableFeature()
            {
                Id = featureId
            };

            autoMocker.Get <IVotableFeatureRetriever>().Expect(mock => mock.RetrieveVotableFeature(featureId))
            .Return(expectedVotableFeature);
            VotableFeatureViewModel expectedVotableFeatureViewModel = Mapper.Map <VotableFeature, VotableFeatureViewModel>(expectedVotableFeature);

            autoMocker.ClassUnderTest.Get(featureId);

            Assert.That(expectedVotableFeatureViewModel.Id, Is.EqualTo(featureId));
        }