public void PostRoomPoints_NotFail_Test()
        {
            bool called   = false;
            var  expected =
                new List <RoomPoint>()
            {
                new RoomPoint()
                {
                    EventDefinitionId = 1
                },
                new RoomPoint()
                {
                    EventDefinitionId = 1
                },
                new RoomPoint()
                {
                    EventDefinitionId = 1
                }
            };

            IEventDefinitionRepository eventDefinitionService = new StubIEventDefinitionRepository()
            {
                AddRoomPointsIEnumerableOfRoomPoint = (roomPoints) =>
                {
                    Assert.AreEqual(expected.Count(), roomPoints.Count());
                    called = true;
                },
                GetByIdInt32 = (id) =>
                {
                    Assert.IsTrue(id == 1);
                    return(new EventDefinition()
                    {
                        OrganizerId = 1
                    });
                }
            };

            using (ShimsContext.Create())
            {
                MyEvents.Api.Authentication.Fakes.ShimMyEventsToken myeventToken = new Authentication.Fakes.ShimMyEventsToken();
                myeventToken.RegisteredUserIdGet     = () => { return(1); };
                ShimMyEventsToken.GetTokenFromHeader = () => { return(myeventToken); };

                var target = new RoomPointsController(eventDefinitionService);

                target.PostRoomPoints(expected);

                Assert.IsTrue(called);
            }
        }
        public void PostRoomPoints_UnauthorizedException_Test()
        {
            var expected =
                new List <RoomPoint>()
            {
                new RoomPoint()
                {
                    EventDefinitionId = 1
                },
                new RoomPoint()
                {
                    EventDefinitionId = 1
                },
                new RoomPoint()
                {
                    EventDefinitionId = 1
                }
            };

            IEventDefinitionRepository eventDefinitionService = new StubIEventDefinitionRepository()
            {
                GetByIdInt32 = (id) =>
                {
                    Assert.IsTrue(id == 1);
                    return(new EventDefinition()
                    {
                        OrganizerId = 1
                    });
                }
            };

            using (ShimsContext.Create())
            {
                MyEvents.Api.Authentication.Fakes.ShimMyEventsToken myeventToken = new Authentication.Fakes.ShimMyEventsToken();
                myeventToken.RegisteredUserIdGet     = () => { return(1000); };
                ShimMyEventsToken.GetTokenFromHeader = () => { return(myeventToken); };

                var target = new RoomPointsController(eventDefinitionService);

                target.PostRoomPoints(expected);
            }
        }