public void SetUp()
        {
            _server = new Browser(new ServerBootstrapper());

            sampleConfig = TestHelper.GetSampleConfig();
            environmentConfig = TestHelper.GetEnvironmentOverrideConfig();

            setConfigResponse = _server.Post("application/new", context =>
            {
                context.HttpRequest();
                context.JsonBody(sampleConfig as object);
            });

            setEnvironmentConfigResponse = _server.Post("application/new", context =>
            {
                context.HttpRequest();
                context.JsonBody(environmentConfig as object);
                context.Query(TestHelper.Environment, "test");
            });

            getCreatedEnvironmentConfigResponse = _server.Get("application/new", context =>
            {
                context.Query(TestHelper.Environment, "test");
            });

            getEnvironmentConfigResult = getCreatedEnvironmentConfigResponse.Body.AsJson();
        }
Example #2
0
        public void ShouldReturnObjectBeingPosted()
        {
            //given
            // arrange
            var cat = new Cat {
                Id = 9, Color = "black", Name = "Cat", Owned = true
            };

            // when
            // act
            actual = sut.Post("/v2/newcat.json", context => context.JsonBody(cat));
            actual = sut.Get("/v2/cats.json", context =>
            {
                context.JsonBody(cat);
                context.Query("name", "Cat");
            });


            // then
            // assert
            var result = actual.Result.Body.DeserializeJson <Cat>();

            Assert.AreEqual(cat.Id, result.Id);
            Assert.AreEqual(cat.Color, result.Color);
        }
Example #3
0
        public void Should_update_user_when_post_user()
        {
            var mock = GetUserServiceLoginMock();

            var bootstraper = new TestBootstrapper(cfg =>
            {
                cfg.Module <UsersModule>();
                cfg.Dependency(mock.Object);
            });
            var browser = new Browser(bootstraper);

            Login(browser);

            var newUser = new User()
            {
                UserName = "******"
            };

            browser.Post("/users/current", with =>
            {
                with.HttpRequest();
                with.Accept(new MediaRange("application/json"));
                with.JsonBody(newUser);
            });

            //Should
            mock.Verify(svc => svc.UpdateUser(It.Is <User>(_ => _.UserName == "newUser" && _.Id == new Guid("{DD0BAA48-9D5F-4167-8672-632D4EE1D27F}"))));
        }
        public override void Observe()
        {
            base.RefreshDb();

            Container.Install(new BusInstaller(), new RepositoryInstaller(), new CommandInstaller());

            var state = StateMother.Draft;
            SaveAndFlush(state, StateMother.Published);



            var id = GetFromDb(state).Id;
            _browser = new Browser(with =>
            {
                with.Module(new StateModule(Container.Resolve<IPublishStorableCommands>(), Container.Resolve<IRepository<State>>()));
            });

            Session.FlushMode = FlushMode.Never;

            //Transaction(x =>
            //{
            _response = _browser.Post("/State/Edit", with =>
            {
                with.HttpRequest();
                with.Body("{ 'id': '" + id + "', 'name': 'Draft', 'alias': 'Test Draft'}");
                with.Header("content-type", "application/json");
                //with.Header("Authorization", "ApiKey 4E7106BA-16B6-44F2-AF4C-D1C411440F8E");
            });
            //});

            Session.Flush();
            // Session.Close();
        }
Example #5
0
        public void EnderecoInvalido()
        {
            var bootstrapper = new FakeBoostrapper();

            bootstrapper.AddressQuery = () =>
                                            {
                                                var fake = new Mock<IAddressQuery>();
                                                fake.Setup(c => c.Execute())
                                                    .Returns(() =>
                                                                 {
                                                                     throw new AddressNotFoundException(
                                                                         "Endereço inválido");
                                                                 });
                                                return fake.Object;
                                            };

            var browser = new Browser(bootstrapper);

            var query = new Query { Addresses = new List<Address>{new Address{Name = "Ebdereco invalido"}}, Type = RouteType.LessTraffic };

            var result = browser.Post("/", with =>
            {
                with.HttpRequest();
                with.JsonBody(query);
            });

            Assert.Equal(HttpStatusCode.InternalServerError, result.StatusCode);
        }
Example #6
0
        public void Should_Return_Created_If_Created()
        {
            var fakePostRepository = new Mock<IPostRepository>();
            var fakePost = new Post();
            fakePostRepository.Setup(x => x.Create(It.IsAny<Post>())).Returns(fakePost);

            var browser = new Browser(
                cfg =>
                {
                    cfg.Module<BlogModule>();
                    cfg.Dependencies<IPostRepository>(fakePostRepository.Object);
                    cfg.RequestStartup((container, pipelines, context) =>
                    {
                        context.CurrentUser = new UserIdentity {UserName = "******"};
                    });
                });

            var result = browser.Post("/", with =>
            {
                with.HttpRequest();
                with.FormValue("Content", "Test Content");
            });

            Assert.Equal(HttpStatusCode.Created, result.StatusCode);
        }
Example #7
0
        public void Should_find_usages_of_class()
        {
            const string editorText = 
@"public class myclass
{
    public void method() { }

    public void method_calling_method()
    {
        method();        
    }
}
";
            var solution = new FakeSolution();
            var project = new FakeProject();
            project.AddFile(editorText);
            solution.Projects.Add(project);

            var bootstrapper = new ConfigurableBootstrapper(c => c.Dependency<ISolution>(solution));
            var browser = new Browser(bootstrapper);

            var result = browser.Post("/findusages", with =>
            {
                with.HttpRequest();
                with.FormValue("FileName", "myfile");
                with.FormValue("Line", "3");
                with.FormValue("Column", "21");
                with.FormValue("Buffer", editorText);
            });

            var usages = result.Body.DeserializeJson<FindUsagesResponse>().Usages.ToArray();
            usages.Count().ShouldEqual(2);
            usages[0].Text.Trim().ShouldEqual("public void method() { }");
            usages[1].Text.Trim().ShouldEqual("method();");
        }
Example #8
0
        public void Creates_user_when_valid_data_is_posted()
        {
            const string login = "******";
            const string password = "******";

            var adapter = new InMemoryAdapter();
            Database.UseMockAdapter(adapter);

            var browser = new Browser(BootstrapperFactory.Create());

            var response = browser.Post("/admin/setup", with =>
            {
                with.HttpRequest();
                with.FormValue("Login", login);
                with.FormValue("Password", password);
            });

            var db = Database.Open();

            var allUsers = db.Users.All().ToList();

            Assert.AreEqual(1, allUsers.Count);
            Assert.AreEqual(login, allUsers[0].Login);
            Assert.AreEqual(password + "salt", allUsers[0].HashedPassword);
            Assert.AreEqual("salt", allUsers[0].Salt);

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
Example #9
0
        public void PostInvalidMemeTypeRequestTest(string text)
        {
            const string unknownResponseText = "Sorry! I don't know what that means! \n\nTo generate a meme for the current channel, type '/meme <memetype>:<meme text>' and I'll generate and insert the meme for you.\nI know about the following memes:\n   - Success Kid (sk)\n   - All The Things (att)\n   - Dwight Schrute (dwight)\n   - I Don't Always (ida)\n   - Doge (doge)\n   - Yoda (yoda1)\n   - Thinkin' Yoda (yoda2)\n";
            const string responseType = "ephemeral";

            var browser = new Browser(cfg =>
            {
                cfg.Module<ImageModule>();
                cfg.Dependency<IRootPathProvider>(new DefaultRootPathProvider());
                cfg.Dependency<ICommandParser>(new CommandParser());
                cfg.Dependency<IBlobStore>(new MockedImageStore("not_invalid"));
                cfg.Dependency<IImageGenerator>(new ImageGenerator(new MockedImageProvider()));
            });

            var result = browser.Post("/image/", context =>
            {
                if (text != null)
                    context.FormValue("text", text);
            });

            var model = result.Body.DeserializeJson<Models.UnknownResponse>();

            Assert.NotNull(model);
            Assert.Equal(responseType, model.response_type);
            Assert.Equal(unknownResponseText, model.text);
            Assert.Null(model.attachments);
        }
 public When_deploying_an_app_that_doesnt_exist()
 {
     _Browser = Testing.CreateBrowser<SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Post("/Deploy/foofoo");
 }
 public When_no_payload_is_sent()
 {
     _Browser = Testing.CreateBrowser<HookModule>();
     _Response = _Browser.Post("/Sites/foofoo/NotifyByEmail", with =>
     {
         with.Query("email", "*****@*****.**");
     });
 }
Example #12
0
 protected static void SignIn(Browser browser)
 {
     browser.Post("/signin", with =>
     {
         with.HttpRequest();
         with.FormValue("Email", "*****@*****.**");
         with.FormValue("Password", "password");
     });
 }
        public void can_fetch_as_text_via_header()
        {
            var sut = new Browser(new Bootstrapper { DataStore = DataStoreForTest });

            var result = sut.Post("/quips", with => with.JsonBody(testData))
                                            .Then.Get("/quip", with => with.Accept("text/plain"));

            result.ContentType.ShouldBe("text/plain");
            result.Body.AsString().ShouldBe("Fixed some errors in the last commit");
        }
 public When_no_application_name_is_specified()
 {
     _Browser = Testing.CreateBrowser<SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Post("/Deploy/jabbr", with =>
     {
         with.FormValue("region_id", "amazon-web-services::us-east-1");
     });
 }
 public When_no_region_id_is_specified()
 {
     _Browser = Testing.CreateBrowser<SecuredPagesModule>(with =>
     {
         with.LoggedInUser();
     });
     _Response = _Browser.Post("/Deploy/jabbr", with =>
     {
         with.FormValue("application_name", "foo");
     });
 }
Example #16
0
        public void can_get_an_awesome_commit_message()
        {
            var sut = new Browser(new Bootstrapper { DataStore = DataStoreForTest });

            var aFunnyMessage = new Quip { Message = "By works, I meant 'doesnt work'. Works now.." };

            var result = sut.Post("/quips", with => with.JsonBody(aFunnyMessage))
                                            .Then.Get("/");

            result.Body["#totally_useful_commit_message"].ShouldExistOnce().And.ShouldContain("works now", StringComparison.InvariantCultureIgnoreCase);
        }
Example #17
0
        public void Should_add_user_login_when_register()
        {
            var mock = GetUserServiceLoginMock();

            mock.Setup(svc => svc.AddUser(It.IsAny <User>())).Returns(Task.Run(() => { }));
            var bootstraper = new TestBootstrapper(cfg =>
            {
                cfg.Module <UsersModule>();
                cfg.Dependency(mock.Object);
            });
            var browser = new Browser(bootstraper);

            var email = "*****@*****.**";

            //when
            var newUser = new NewUserViewModel()
            {
                UserName = "******",
                Email    = email,
                Country  = "Switzerland",
                Location = "Courtaman",
                Password = "******",
                Street   = "Schulweg 28",
                Zip      = "1791"
            };
            var result = browser.Post("/users/register", with =>
            {
                with.HttpRequest();
                with.Accept(new MediaRange("application/json"));
                with.JsonBody(newUser);
            });

            //Should
            mock.Verify(svc => svc.AddUser(It.Is <User>(_ =>
                                                        _.UserName == newUser.UserName &&
                                                        _.Country == newUser.Country &&
                                                        _.Location == newUser.Location &&
                                                        _.Street == newUser.Street &&
                                                        _.Zip == newUser.Zip
                                                        )));

            mock.Verify(_ => _.AddEmail(It.Is <User>(u => u.UserName == newUser.UserName), email));

            mock.Verify(svc => svc.AddLogin(It.Is <User>(_ =>
                                                         _.UserName == newUser.UserName), newUser.Password, false));

            var user = result.Get <User>();

            Assert.AreEqual(user.UserName, newUser.UserName);
            Assert.AreEqual(user.Country, newUser.Country);
            Assert.AreEqual(user.Location, newUser.Location);
            Assert.AreEqual(user.Street, newUser.Street);
            Assert.AreEqual(user.Zip, newUser.Zip);
        }
        public void can_fetch_as_json_via_extension()
        {
            var sut = new Browser(new Bootstrapper { DataStore = DataStoreForTest });

            var result = sut.Post("/quips", with => with.JsonBody(testData))
                                            .Then.Get("/quip.json");

            var returnedQuip = result.Body.DeserializeJson<Quip>();

            returnedQuip.Message.ShouldBe("Fixed some errors in the last commit");
        }
        public void When_post_playlist_must_be_success()
        {
            var mockedMagicPlaylistGateway = MockedMagicPlaylistGateway
                                                .Create()
                                                .CanAddPlaylist(true);

            var browser = new Browser(cfg =>
            {
                cfg.Module<HomeModule>();
                cfg.Dependency(BuildSuccessRadioGateway());
                cfg.Dependency(mockedMagicPlaylistGateway.Build());
                cfg.Dependency(BuildSuccessHttpDeezer());
            });

            var response = browser.Post("/playlist", (with) => {
                with.HttpRequest();
                with.FormValue("id", "1");
                with.FormValue("accessToken", "abcde");
                with.FormValue("firstname", "Nicolas");
                with.FormValue("lastname", "Delfour");
                with.FormValue("email", "*****@*****.**");
                with.FormValue("gender", "M");
                with.FormValue("name", "Nico");
                with.FormValue("country", "FR");
                with.FormValue("lang", "FR");
                with.FormValue("birthday", "1980-02-25");
            });

            var userTable = mockedMagicPlaylistGateway._userTable;
            var userStored = userTable
                                .Where(x => x.Key == 1)
                                .Select(x => x.Value)
                                .SingleOrDefault();

            Assert.AreEqual(1, userTable.Count);
            Assert.IsNotNull(userStored);
            Assert.AreEqual(1, userStored.Id);
            Assert.AreEqual("abcde", userStored.AccessToken);
            Assert.AreEqual("Nicolas", userStored.Firstname);
            Assert.AreEqual("Delfour", userStored.Lastname);
            Assert.AreEqual("*****@*****.**", userStored.Email);
            Assert.AreEqual("M", userStored.Gender);
            Assert.AreEqual("Nico", userStored.Name);
            Assert.AreEqual("FR", userStored.Country);
            Assert.AreEqual("FR", userStored.Lang);
            Assert.AreEqual("1980-02-25", userStored.Birthday);

            Assert.AreEqual(0, mockedMagicPlaylistGateway._logTable.Count);

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.AreEqual("application/json; charset=utf-8", response.ContentType);
            Assert.AreEqual("{\"success\":true,\"playlistUrl\":\"https://www.deezer.com/playlist/12345\"}", response.Body.AsString());
        }
Example #20
0
        public void will_it_post()
        {
            var browser = new Browser(with => with.Module(new HomeModule()));
            Fish model = new Fish() { Id = 2, Name = "Siika" };

            var response = browser.Post("/", with =>
            {
                with.JsonBody(model);
            });

            Xunit.Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
Example #21
0
        public void TestCanAddStreamForSubscriber()
        {
            var database = new Mock<IDatabaseClient>();

            var browser = new Browser(with => with.Module(new Hub(database.Object)));
            browser.Post("/user/stream/subscription/", with =>
                {
                    with.HttpRequest();
                    with.FormValue("Name", "KnwownUser");
                    with.FormValue("Stream", "https://news.ycombinator.com/rss");
                });
        }
        public static string Authenticate(Browser browser)
        {
            var username = Environment.GetEnvironmentVariable("ADMIN_USERNAME");
              var password = Environment.GetEnvironmentVariable("ADMIN_PASSWORD");

              var response = browser.Post("/authenticate", with => {
            with.HttpRequest();
            with.Header("User-Agent", "test");
            with.JsonBody<User>(new User { Username = username, Password = password });
              });
              return response.Context.JsonBody<Authenticate>().Token;
        }
Example #23
0
        public void can_create_a_book()
        {
            var bootstrapper = new DefaultNancyBootstrapper();
            var browser = new Browser(bootstrapper);
            var newTitle = Guid.NewGuid().ToString();
            var result = browser.Post("/books/new", with =>
            {
                with.HttpRequest();
                with.FormValue("Title", newTitle);
            });

            Assert.AreEqual(HttpStatusCode.Created.ToString(), result.StatusCode.ToString());
        }
        public void TestRequiresSparqlUpdatePermissions()
        {
            var brightstar = new Mock<IBrightstarService>();
            var permissions = new Mock<AbstractStorePermissionsProvider>();
            permissions.Setup(s=>s.HasStorePermission(null, "foo", StorePermissions.SparqlUpdate)).Returns(false).Verifiable();
            var app = new Browser(new FakeNancyBootstrapper(brightstar.Object, permissions.Object));

            var response = app.Post("/foo/update", with => with.FormValue("update", "update expression"));

            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized));
            permissions.Verify();

        }
        public void Should_not_accept_invalid_password()
        {
            var diagsConfig = new DiagnosticsConfiguration { Password = "******", CryptographyConfiguration = this.cryptoConfig };
            var bootstrapper = new ConfigurableBootstrapper(b => b.DiagnosticsConfiguration(diagsConfig));
            var browser = new Browser(bootstrapper);

            var result = browser.Post("/_Nancy", with =>
            {
                with.FormValue("Password", "wrongpassword");
            });

            result.Body["#login"].ShouldExistOnce();
            result.Cookies.Any(c => c.Name == DiagsCookieName && !string.IsNullOrEmpty(c.Value)).ShouldBeFalse();
        }
Example #26
0
        public void Post_redirects_to_login_when_at_least_one_user_exists()
        {
            var adapter = new InMemoryAdapter();
            Database.UseMockAdapter(adapter);

            var db = Database.Open();
            db.Users.Insert(Login: "******", HashedPassword: "******", Salt: "salt", Guid: "5240cdc7-f32c-4d7f-9d27-f76a4a87d881");

            var browser = new Browser(BootstrapperFactory.Create());

            var response = browser.Post("/admin/setup", with => with.HttpRequest());

            response.ShouldHaveRedirectedTo("/admin/login");
        }
 public When_a_notification_is_sent()
 {
     _Mail = new Mock<IMailService>(MockBehavior.Strict);
     _Mail.Setup(d => d.SendEmail(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()));
     _Browser = Testing.CreateBrowser<HookModule>(with =>
     {
         with.Mail(_Mail);
     });
     _Response = _Browser.Post("/Sites/foofoo/NotifyByEmail", with =>
     {
         with.JsonBody(new ServiceHookModel { Application = new ServiceHookApplicationModel { Name = "Foo Foo" }, Build = new ServiceHookBuildModel { Status = "Succeeded", Commit = new ServiceHookCommitModel { Id = "12345", Message = "Test Message" } } });
         with.Query("email", "*****@*****.**");
     });
 }
        public void TestThatEmptyPost_BadRequest()
        {
            var bootstrapper = new DefaultNancyBootstrapper();
            var browser = new Browser(bootstrapper);

            // When
            var result = browser.Post("/api/login", with =>
            {
                with.HttpRequest();
            });

            // Then
            Assert.AreEqual(HttpStatusCode.BadRequest, result.StatusCode);
        }
Example #29
0
        public void Add_returns_correct_json()
        {
            var adapter = new InMemoryAdapter();
            Database.UseMockAdapter(adapter);

            var postStore = A.Fake<IPostStore>();
            var addDraftResult = new AddDraftResult
                {
                    Id = 1,
                    Success = true,
                    Title = "The Title",
                    Url = "/admin/posts/edit/1"
                };

            A.CallTo(() => postStore.AddDraft("The Title")).Returns(addDraftResult);

            FakeRootPathProvider.RootPath = "../../../Markie";

            var bootstrapper = new ConfigurableBootstrapper(with =>
                {
                    with.RootPathProvider(new FakeRootPathProvider());
                    with.Dependency<FakePasswordService>();
                    with.Dependency(postStore);
                    with.RequestStartup((container, pipelines, context) =>
                        {
                            var formsAuthConfiguration = new FormsAuthenticationConfiguration()
                                {
                                    RedirectUrl = "~/admin/login",
                                    UserMapper = new UserMapper()
                                };

                            FormsAuthentication.Enable(pipelines, formsAuthConfiguration);
                        });
                });
            var browser = new Browser(bootstrapper);

            var jsonResult = browser.Post("/admin/posts/add", with =>
                {
                    with.HttpRequest();
                    with.FormValue("title", "The Title");
                });

            var result = Newtonsoft.Json.JsonConvert.DeserializeObject<AddDraftResult>(jsonResult.Body.AsString());

            Assert.AreEqual(addDraftResult.Id, result.Id);
            Assert.AreEqual(addDraftResult.Success, result.Success);
            Assert.AreEqual(addDraftResult.Title, result.Title);
            Assert.AreEqual(addDraftResult.Url, result.Url);
        }
        public void AddRatings()
        {
            var browser = new Browser(new TestWebBootstrapper());

            // 1
            browser.Post(string.Format("/{0}/Ratings", FeatureContext.Current["TokenKey"]), with =>
            {
                with.HttpRequest();
                with.FormValue("Rating", "50");
                with.FormValue("UniqueKey", "1");
                with.FormValue("CustomParams", "{ \"RelatedContent\": \"1012\" }");
            });

            // 2
            browser.Post(string.Format("/{0}/Ratings", FeatureContext.Current["TokenKey2"]), with =>
            {
                with.HttpRequest();
                with.FormValue("Rating", "6");
                with.FormValue("UniqueKey", "2");
                with.FormValue("CustomParams", "{ \"RelatedContent\": \"1234\" }");
            });

            // 3
            browser.Post(string.Format("/{0}/Ratings", FeatureContext.Current["TokenKey3"]), with =>
            {
                with.HttpRequest();
                with.FormValue("Rating", "7");
                with.FormValue("UniqueKey", "3");
                with.FormValue("CustomParams", "{ \"RelatedContent\": \"1245\" }");
            });

            browser.Post(string.Format("/{0}/Ratings", FeatureContext.Current["TokenKey4"]), with =>
            {
                with.HttpRequest();
                with.FormValue("Rating", "2");
                with.FormValue("UniqueKey", "3");
                with.FormValue("CustomParams", "{ \"UserId\": \"1245444\" }");
            });

            browser.Post(string.Format("/{0}/Ratings", FeatureContext.Current["TokenKey5"]), with =>
            {
                with.HttpRequest();
                with.FormValue("Rating", "10");
                with.FormValue("UniqueKey", "3");
                with.FormValue("CustomParams", "{ \"UserId\": \"65656756\" }");
            });

            // 4
            browser.Post(string.Format("/{0}/Ratings", FeatureContext.Current["TokenKey6"]), with =>
            {
                with.HttpRequest();
                with.FormValue("Rating", "44");
                with.FormValue("UniqueKey", "4");
                with.FormValue("CustomParams", "{ \"RelatedContent\": \"1337\" }");
            });
        }
Example #31
0
        public void Should_be_return_401()
        {
            var bowser = new Browser(with =>
            {
                with.Module<IndexModule>();
                with.Dependencies<IBaseRepository<t_user>>(new BaseRepository<t_user>());
            });
            var response = bowser.Post("api/values", with =>
            {
                with.Header("Accept", "Application/json");
                with.Header("Content-Type", "Application/json");
            });

            Assert.AreEqual(response.StatusCode, HttpStatusCode.Unauthorized);
        }
        public void should_be_able_to_post_a_raw_body()
        {
            // Given
            var browser = new Browser(with => with.Module<JsonModelBindingModule>());

            // When
            var result = browser.Post("/jsonlist", with =>
            {
                with.Body(_json);
                with.Header("content-type", "application/json");
            });

            // Then
            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
        }
        public void TestThatNonNetlightPost_BadRequest()
        {
            var bootstrapper = new DefaultNancyBootstrapper();
            var browser = new Browser(bootstrapper);

            // When
            var result = browser.Post("/api/login", with =>
            {
                with.FormValue("Username", "*****@*****.**");
                with.HttpRequest();
            });

            // Then
            Assert.AreEqual(HttpStatusCode.BadRequest, result.StatusCode);
        }
Example #34
0
        public void Should_block_when_anonymous_update_user()
        {
            var mock = GetUserServiceLoginMock();

            var bootstraper = new TestBootstrapper(cfg =>
            {
                cfg.Module <UsersModule>();
                cfg.Dependency(mock.Object);
            });
            var browser = new Browser(bootstraper);
            var result  = browser.Post("/users/current", with =>
            {
                with.HttpRequest();
                with.Accept(new MediaRange("application/json"));
                with.JsonBody(new User()
                {
                    UserName = "******"
                });
            });

            Assert.AreEqual(result.StatusCode, HttpStatusCode.Forbidden);
        }