public void DeleteMaterial_Deleted_NotFail_Test()
        {
            bool called = false;
            var expectedmaterial = new Material() { MaterialId = 1, SessionId = 1 };
            int organizerId = 10;

            ISessionRepository sessionRepository = new StubISessionRepository();
            IMaterialRepository materialRepository = new StubIMaterialRepository()
            {
                DeleteInt32 = materialId =>
                {
                    Assert.AreEqual(expectedmaterial.MaterialId, materialId);
                    called = true;
                },
                GetOrganizerIdInt32 = materialId =>
                {
                    return organizerId;
                }
            };

            using (ShimsContext.Create())
            {
                MyEvents.Api.Authentication.Fakes.ShimMyEventsToken myeventToken = new Authentication.Fakes.ShimMyEventsToken();
                myeventToken.RegisteredUserIdGet = () => { return organizerId;  };
                ShimMyEventsToken.GetTokenFromHeader = () => { return myeventToken; };
                var target = new MaterialsController(materialRepository, sessionRepository);

                target.Delete(expectedmaterial.MaterialId);

                Assert.IsTrue(called);
            }
        }
        public void DeleteMaterial_UnauthorizedException_Test()
        {
            var expectedmaterial = new Material() { MaterialId = 1, SessionId = 1 };
            int organizerId = 10;

            ISessionRepository sessionRepository = new StubISessionRepository()
            {
                GetOrganizerIdInt32 = (sessionId) =>
                {
                    return organizerId;
                }
            };

            IMaterialRepository materialRepository = new StubIMaterialRepository()
            {
                GetInt32 = materialId =>
                {
                    return expectedmaterial;
                }
            };

            using (ShimsContext.Create())
            {
                MyEvents.Api.Authentication.Fakes.ShimMyEventsToken myeventToken = new Authentication.Fakes.ShimMyEventsToken();
                myeventToken.RegisteredUserIdGet = () => { return 100000; };
                ShimMyEventsToken.GetTokenFromHeader = () => { return myeventToken; };
                var target = new MaterialsController(materialRepository, sessionRepository);

                target.Delete(expectedmaterial.MaterialId);
            }
        }