Esempio n. 1
0
        public async Task EditGroup_ShouldReturnCorrectTwitterHandleFormat()
        {
            var groupAdmins = new GroupAdministrators();

            groupAdmins.Items.Add(new GroupAdministratorItems()
            {
                Email = "*****@*****.**"
            });


            var group = new Group("name", "slug", "metaDescription", "010101010", "*****@*****.**", "www.website.com",
                                  "https://www.twitter.com/testHandle", "www.facebook.com", "address", "description", "image-url",
                                  "thumnail-url", new List <GroupCategory> {
                new GroupCategory {
                    Name = "testCategory"
                }
            }, new List <GroupSubCategory>(), new List <Crumb>(),
                                  new MapPosition {
                Lat = 100, Lon = 200
            }, false, new List <Event>(), new GroupAdministrators(), DateTime.MinValue,
                                  DateTime.MinValue, "status", new List <string>(), "£1", "ability", false, "volunteer text",
                                  new Organisation(), new List <Group>(), false, "tenaport-link", new List <GroupBranding>(), "aditional-info",
                                  new List <Document>(), DateTime.MinValue, new List <string>(), new List <string>(), "donation-text", "donation-url",
                                  new List <Alert>());

            var loggedInPerson = new LoggedInPerson
            {
                Email = "*****@*****.**"
            };

            _repository.Setup(_ => _.Get <Group>(It.IsAny <string>(), It.IsAny <List <Query> >()))
            .ReturnsAsync(StockportWebapp.Http.HttpResponse.Successful((int)HttpStatusCode.OK, group));
            _groupsService.Setup(_ =>
                                 _.HasGroupPermission(It.IsAny <string>(), It.IsAny <List <GroupAdministratorItems> >(),
                                                      It.IsAny <string>())).Returns(true);
            _markdownWrapper.Setup(_ => _.ConvertToHtml(It.IsAny <string>()));
            _groupsService.Setup(_ => _.GetVolunteeringText(It.IsAny <string>()));
            _groupsService.Setup(_ => _.GetAvailableGroupCategories()).ReturnsAsync(new List <string>());

            // Act
            var view = await _groupController.EditGroup("slug", loggedInPerson) as ViewResult;

            var model = view.ViewData.Model as GroupSubmission;

            Assert.Equal("@testHandle", model.Twitter);
        }