Ejemplo n.º 1
0
        public async Task Get_OneSupportedPlanPresent_SupportedPlanReturned()
        {
            //Arrange
            var fakeMediator = Substitute.For <IMediator>();

            fakeMediator
            .Send(Arg.Any <GetSupportedPlansQuery>())
            .Returns(new[]
            {
                new Plan(
                    "some-bundle-id",
                    1337,
                    new Bundle(),
                    Array.Empty <PullDogPlan>())
            });

            var mapper = AutoMapperFactory.CreateValidMapper();

            var controller = new PlansController(
                mapper,
                fakeMediator);

            //Act
            var responses = await controller.Get();

            //Assert
            var responsesArray = responses.ToArray();

            Assert.AreEqual(1, responsesArray.Length);

            Assert.AreEqual("some-bundle-id", responsesArray.Single().Id);
        }
Ejemplo n.º 2
0
        public async void PlanController_Will_ReturnEmptyOkResult_If_No_Plan_Found()
        {
            //Act
            PlansController PlanController = CreatePlanController(_testUserAccount.Id, _testUserAccount.EmailAddress.Address);

            //Assert
            var postResult = await PlanController.Get(new PlansGetParams()
            {
                id = FixtureData.GetTestGuidById(55)
            });

            //FixtureData.GetTestGuidById(55));
            Assert.IsNull(postResult as OkNegotiatedContentResult <PlanDO>);
        }