public void UserViewController_DeleteUserView_Returns_BadResponse(UserViewDelete vwID) { #region Arrange SetupUserViewRepository(); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPDELETE), $"{AppSettings.BASEURL}{RouteHelper.UserviewRoutePrefix}/{vwID.viewId}"); UserViewController userViewController = CreateUserViewController(httpRequest, userViewRepository.Object, userViewScreenRepository.Object); #endregion #region Act var response = userViewController.Delete(vwID.viewId, vwID.userviewdelete) as BadRequestErrorMessageResult; #endregion #region Assert string expectedMessage = (vwID.userviewdelete == null) ? "Json Input not found" : "Screen name is not equal to GRS.UW_Workbench"; Assert.IsInstanceOf <BadRequestErrorMessageResult>(response); Assert.AreEqual(expectedMessage, response.Message); #endregion }
public void UserViewController_Put_Returns_BadRequest(UserView userviews) { #region Arrange SetupUserIdentity(); SetupUserViewRepository(out Mock <IUserViewRepository> userviewRepository); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPPOST), $"{AppSettings.BASEURL}{RouteHelper.UserviewRoutePrefix}"); UserViewController userviewController = CreateUserViewController(httpRequest, userViewRepository.Object, userViewScreenRepository.Object); #endregion #region Act var response = userviewController.Put(userviews.ViewId, userviews); #endregion #region Assert var expectedStatusCode = (userviews == null) ? HttpStatusCode.NoContent : HttpStatusCode.BadRequest; var result = response as StatusCodeResult; Assert.AreEqual(expectedStatusCode, result.StatusCode); #endregion }
public void UserViewController_DeleteUserView_Returns_OKResponseCode(UserViewDelete vwID) { #region Arrange SetupUserViewRepository(); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPDELETE), $"{AppSettings.BASEURL}{RouteHelper.UserviewRoutePrefix}/{vwID.viewId}"); UserViewController userViewController = CreateUserViewController(httpRequest, userViewRepository.Object, userViewScreenRepository.Object); #endregion #region Act var response = userViewController.Delete(vwID.viewId, vwID.userviewdelete); #endregion #region Assert var contentResult = response as NegotiatedContentResult <Response>; Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode); Assert.IsNotEmpty(contentResult.Content.messages); #endregion }
private UserViewController CreateUserViewController(HttpRequestMessage httpRequest, IUserViewRepository userViewRepository, IUserViewScreenRepository userViewScreenRepository) { UserViewManager UserViewManager = new UserViewManager(userManager.Object, cacheStoreManager.Object, mockLogManager.Object, userViewRepository, transformationManager, userViewScreenRepository); UserPreferencesAPIManager userViewAPIManager = new UserPreferencesAPIManager(userManager.Object, cacheStoreManager.Object, mockLogManager.Object, UserViewManager); UserViewController userViewController = new UserViewController(userManager.Object, userViewAPIManager) { Request = httpRequest, Configuration = new HttpConfiguration() }; return(userViewController); }
public void UserViewController_DefaultGetWithViewID_Returns_OKResponseCode(UserViewIDSearch vwId) { #region Arrange var ViewID = vwId.viewId; SetupUserViewRepository(); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPGET), $"{AppSettings.BASEURL}{RouteHelper.UserviewRoutePrefix}/{ViewID}"); UserViewController userViewController = CreateUserViewController(httpRequest, userViewRepository.Object, userViewScreenRepository.Object); #endregion #region Act var response = userViewController.Get(ViewID); var contentResult = response as NegotiatedContentResult <ResponseItem <UserView> >; #endregion #region Assert #region Expected Data var expectedUserView = new UserView() { ViewId = 101, UserId = 100, Default = false, ScreenName = "GRS.UW_Workbench", ViewName = "mysubmissions", Layout = "SomeJason", CustomView = false, SortOrder = 1 }; #endregion Assertions.AssertOkResponse(contentResult); var UserViewsData = contentResult.Content.data; //Data var actualUserView = UserViewsData; Assertions.AssertData(expectedUserView, actualUserView); //Links & Messages // Assert.IsEmpty(contentResult.Content.links); Assert.IsEmpty(contentResult.Content.messages); #endregion }
public void UserViewScreenController_Get_Returns_BadResponse(UserViewSearchCriteria criteria) { #region Arrange SetupUserIdentity(); //Build response IList <grs_VGrsUserView> userViewScreenDbData = new List <grs_VGrsUserView> { new grs_VGrsUserView { ViewId = 101, Userid = 100, Default = false, Screenname = "GRS.UW_Workbench", Viewname = "mysubmissions", Layout = "SomeJason", Customview = false, Sortorder = 1 } }; // Search method userViewScreenRepository.Setup(p => p.GetMany(It.IsAny <Expression <Func <grs_VGrsUserView, bool> > >())).Returns(userViewScreenDbData); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPGET), $"{AppSettings.BASEURL}{RouteHelper.UserviewRoutePrefix}"); UserViewController userviewController = CreateUserViewController(httpRequest, userViewRepository.Object, userViewScreenRepository.Object); #endregion #region Act var response = userviewController.Get(criteria) as BadRequestErrorMessageResult; #endregion #region Assert string expectedMessage = "No Parameter found"; Assert.IsInstanceOf <BadRequestErrorMessageResult>(response); Assert.AreEqual(expectedMessage, response.Message); }
private void ExploreMap(bool onOff) { //MapData currentMap = MapLoaderController.mapLoaderInScene.currentMap; if ((bool)MapData.loadedMap?.IsBuilt) { UserViewController viewingCamera = SettingsController.settingsInScene.viewingCamera; SettingsController.settingsInScene.SetViewingCamera(onOff); //GameObject mapObj = MapData.loadedMap.GetGameObject(); //mapObj.SetActive(onOff); if (onOff) { Bounds mapBounds = MapData.loadedMap.GetBounds(); Rect cameraRect = CameraHelpers.Aspectify(mapBounds.min.xz(), mapBounds.max.xz(), viewingCamera.viewingCamera.aspect); float cameraHeight = Camera.main.PerspectiveDistanceFromWidth(cameraRect.width); viewingCamera.transform.position = new Vector3(0, cameraHeight * 0.1f, 0); viewingCamera.transform.rotation = Quaternion.LookRotation(Vector3.down); } } }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 2 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" ViewData["Title"] = "Preview"; var x = Model.First().Passo.Receita.Id; var name = Model.First().Passo.Receita.Nome; #line default #line hidden BeginContext(206, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(357, 6, true); WriteLiteral("\r\n<h1>"); EndContext(); BeginContext(364, 4, false); #line 14 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" Write(name); #line default #line hidden EndContext(); BeginContext(368, 53, true); WriteLiteral("</h1>\r\n<div class=\"col-xs-12\" style=\"height:50px;\">\r\n"); EndContext(); BeginContext(587, 190, true); WriteLiteral("</div>\r\n<table class=\"table\">\r\n <thead>\r\n <tr>\r\n <th scope=\"col\">Ingredient</th>\r\n <th scope=\"col\">Quantity</th>\r\n\r\n </tr>\r\n </thead>\r\n <tbody>\r\n"); EndContext(); #line 32 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" foreach (var user in Model) { #line default #line hidden BeginContext(826, 38, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(865, 21, false); #line 35 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" Write(user.Ingrediente.Nome); #line default #line hidden EndContext(); BeginContext(886, 27, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(914, 15, false); #line 36 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" Write(user.Quantidade); #line default #line hidden EndContext(); BeginContext(929, 28, true); WriteLiteral("</td>\r\n\r\n </tr>\r\n"); EndContext(); #line 39 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" } #line default #line hidden BeginContext(968, 24, true); WriteLiteral(" </tbody>\r\n</table>\r\n"); EndContext(); #line 42 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" UserViewController cc = new UserViewController(); List <IngQtd> lista = cc.getListaCompras(x, User.Identity.Name); if (lista.Count > 0) { ViewBag.Status = -40; } #line default #line hidden BeginContext(1199, 2, true); WriteLiteral("\r\n"); EndContext(); #line 52 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" if (ViewBag.Status == 40) { #line default #line hidden BeginContext(1232, 21, true); WriteLiteral(" <p align=\"right\">"); EndContext(); BeginContext(1253, 99, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "509571ede5029c17b10538eb048e992063e8edf59052", async() => { BeginContext(1343, 5, true); WriteLiteral("Start"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 54 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" WriteLiteral(x); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-num", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["num"] = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1352, 6, true); WriteLiteral("</p>\r\n"); EndContext(); #line 55 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" } #line default #line hidden BeginContext(1361, 17, true); WriteLiteral("<p align=\"right\">"); EndContext(); BeginContext(1378, 61, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "509571ede5029c17b10538eb048e992063e8edf512403", async() => { BeginContext(1431, 4, true); WriteLiteral("Back"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1439, 23, true); WriteLiteral("</p>\r\n<p align=\"right\">"); EndContext(); BeginContext(1462, 92, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "509571ede5029c17b10538eb048e992063e8edf514004", async() => { BeginContext(1534, 16, true); WriteLiteral("Add to Favorites"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_5.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 57 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" WriteLiteral(x); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1554, 6, true); WriteLiteral("</p>\r\n"); EndContext(); #line 58 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" if (lista.Count > 0) { #line default #line hidden BeginContext(1597, 26, true); WriteLiteral(" <p align=\"right\"> "); EndContext(); BeginContext(1623, 111, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "509571ede5029c17b10538eb048e992063e8edf516896", async() => { BeginContext(1692, 38, true); WriteLiteral("<font color=\"red\">Shopping List</font>"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_6.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-rid", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 61 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" WriteLiteral(x); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["rid"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-rid", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["rid"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1734, 6, true); WriteLiteral("</p>\r\n"); EndContext(); #line 62 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Preview.cshtml" } #line default #line hidden BeginContext(1750, 2, true); WriteLiteral("\r\n"); EndContext(); }
public static UserViewController Fixture() { UserViewController controller = new UserViewController(new UserViewRepository(), "", new LoginView()); return(controller); }
public void UserViewScreenController_Get_Returns_OKResponseCode(UserViewSearchCriteria criteria) { #region Arrange SetupUserIdentity(); //Build response IList <grs_VGrsUserView> userViewScreenDbData = new List <grs_VGrsUserView> { new grs_VGrsUserView { ViewId = 101, Userid = 100, Default = false, Screenname = "GRS.UW_Workbench", Viewname = "mysubmissions", Layout = "SomeJason", Customview = false, Sortorder = 1 } }; // Search method userViewScreenRepository.Setup(p => p.GetMany(It.IsAny <Expression <Func <grs_VGrsUserView, bool> > >())).Returns(userViewScreenDbData); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPGET), $"{AppSettings.BASEURL}{RouteHelper.UserviewRoutePrefix}"); UserViewController userviewController = CreateUserViewController(httpRequest, userViewRepository.Object, userViewScreenRepository.Object); #endregion #region Act var response = userviewController.Get(criteria); var contentResult = response as NegotiatedContentResult <ResponseCollection <UserView> >; #endregion #region Assert #region Expected var expectedUserViewScreen = new UserView { ViewId = 101, UserId = 100, Default = false, ScreenName = "GRS.UW_Workbench", ViewName = "mysubmissions", Layout = null, CustomView = false, SortOrder = 1 }; //var expectedGetLink = new Link(LinkType.RelatedEntity, EntityType.Notes, $"v1/userviews?screenname={expectedUserViewScreen.ScreenName}", HttpMethodType.GET); #endregion Assertions.AssertOkResponse(contentResult); var summaryData = contentResult.Content.results; for (int i = 0; i <= summaryData.Count - 1; i++) { //Data var actualUserViewScreen = summaryData[i].data; Assertions.AssertData(expectedUserViewScreen, actualUserViewScreen); // Links & Messages //Assert.Multiple(() => //{ // Assert.IsNotEmpty(summaryData[i].links); // Assert.AreEqual(1, summaryData[i].links.Count); // Assertions.AssertLink(expectedGetLink, summaryData[i].links[0]); //}); Assert.IsEmpty(summaryData[i].messages); } #endregion }
public void UserViewController_Post_Returns_Created(UserView userViews) { #region Arrange SetupUserIdentity(); userViewRepository = new Mock <IUserViewRepository>(); //SetupUserViewRepository(out Mock<IUserViewRepository> userviewsRepository); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPPOST), $"{AppSettings.BASEURL}{RouteHelper.UserviewRoutePrefix}"); UserViewController userviewController = CreateUserViewController(httpRequest, userViewRepository.Object, userViewScreenRepository.Object); var userviewdata = new grs_TblUserview() { ViewId = 101, Userid = 100, Default = false, Screenname = "GRS.UW_Workbench", Viewname = "mysubmissions", Layout = "SomeJason", Customview = false, Sortorder = 1 }; grs_TblUserview nullData = null; userViewRepository.SetupSequence(p => p.Get(It.IsAny <Expression <Func <grs_TblUserview, bool> > >())) .Returns(nullData) .Returns(userviewdata); #endregion #region Act var response = userviewController.Post(userViews); #endregion #region Expected Data var expectedUserViewdata = new UserView() { ViewId = 101, UserId = 100, Default = false, ScreenName = "GRS.UW_Workbench", ViewName = "mysubmissions", Layout = "SomeJason", CustomView = false, SortOrder = 1 }; #endregion #region Assert var contentResult = response as NegotiatedContentResult <ResponseItem <UserView> >; Assertions.AssertCreatedResponse(contentResult); var usrViewData = contentResult.Content.data; //Data var actualUserViewdata = usrViewData; Assertions.AssertData(expectedUserViewdata, actualUserViewdata); //Links & Messages // Assert.IsEmpty(contentResult.Content.links); Assert.IsEmpty(contentResult.Content.messages); #endregion }
public void UserViewController_Put_Returns_OkCode(UserView userveiws) { #region Arrange SetupUserIdentity(); SetupUserViewRepository(out Mock <IUserViewRepository> userViewRepository); var usrViewRepository = new Mock <IUserViewRepository>(); #endregion #region Act var usrViewDbData = new grs_TblUserview() { ViewId = 46, Userid = 4896, Default = false, Screenname = "GRS.UW_Workbench", Viewname = "mysubmissions", Layout = "SomeJason", Customview = false, Sortorder = 1 }; usrViewRepository.Setup(p => p.Get(It.IsAny <Expression <Func <grs_TblUserview, bool> > >())).Returns(usrViewDbData); usrViewRepository.Setup(p => p.Get(46)).Returns(usrViewDbData); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPPOST), $"{AppSettings.BASEURL}{RouteHelper.UserviewRoutePrefix}"); UserViewManager UserViewManager = new UserViewManager(userManager.Object, cacheStoreManager.Object, mockLogManager.Object, usrViewRepository.Object, transformationManager); UserPreferencesAPIManager userViewAPIManager = new UserPreferencesAPIManager(userManager.Object, cacheStoreManager.Object, mockLogManager.Object, UserViewManager); UserViewController userviewController = new UserViewController(userManager.Object, userViewAPIManager) { Request = httpRequest, Configuration = new HttpConfiguration() }; #endregion #region Act var response = userviewController.Put(userveiws.ViewId, userveiws); #endregion #region Expected Data var expectedUserViewdata = new UserView() { ViewId = 46, UserId = 4896, Default = false, ScreenName = "GRS.UW_Workbench", ViewName = "mysubmissions", Layout = "SomeJason", CustomView = false, SortOrder = 1 }; #region Assert var contentResult = response as NegotiatedContentResult <ResponseItem <UserView> >; Assertions.AssertOkResponse(contentResult); var usrViewData = contentResult.Content.data; //Data var actualUserViewdata = usrViewData; Assertions.AssertData(expectedUserViewdata, actualUserViewdata); //Links & Messages // Assert.IsEmpty(contentResult.Content.links); Assert.IsEmpty(contentResult.Content.messages); #endregion }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 2 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" ViewData["Title"] = "GetRecipes"; #line default #line hidden BeginContext(98, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(249, 336, true); WriteLiteral(@" <h1>Recipes</h1> <div class=""col-xs-12"" style=""height:50px;""></div> <table class=""table""> <thead> <tr> <th scope=""col"">Name</th> <th scope=""col"">Dificulty</th> <th scope=""col"">Nutrition</th> <th scope=""col"">Category</th> </tr> </thead> <tbody> "); EndContext(); #line 25 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" foreach (var user in Model) { UserViewController cc = new UserViewController(); List <IngQtd> lista = cc.getListaCompras(user.Id, User.Identity.Name); if (lista.Count == 0) { #line default #line hidden BeginContext(832, 46, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(879, 9, false); #line 33 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" Write(user.Nome); #line default #line hidden EndContext(); BeginContext(888, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(920, 16, false); #line 34 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" Write(user.Dificuldade); #line default #line hidden EndContext(); BeginContext(936, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(968, 13, false); #line 35 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" Write(user.Nutricao); #line default #line hidden EndContext(); BeginContext(981, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1013, 24, false); #line 36 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" Write(user.Categoria.Descricao); #line default #line hidden EndContext(); BeginContext(1037, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1068, 105, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "c32dc52b75c6f67b04b8f494002949e7e0bbd0c19164", async() => { BeginContext(1162, 7, true); WriteLiteral("Preview"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 37 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" WriteLiteral(user.Id); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-status", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["status"] = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1173, 30, true); WriteLiteral("</td>\r\n </tr>\r\n"); EndContext(); #line 39 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" } if (lista.Count > 0) { #line default #line hidden BeginContext(1267, 46, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(1314, 9, false); #line 43 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" Write(user.Nome); #line default #line hidden EndContext(); BeginContext(1323, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1355, 16, false); #line 44 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" Write(user.Dificuldade); #line default #line hidden EndContext(); BeginContext(1371, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1403, 13, false); #line 45 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" Write(user.Nutricao); #line default #line hidden EndContext(); BeginContext(1416, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1448, 24, false); #line 46 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" Write(user.Categoria.Descricao); #line default #line hidden EndContext(); BeginContext(1472, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1503, 105, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "c32dc52b75c6f67b04b8f494002949e7e0bbd0c114185", async() => { BeginContext(1597, 7, true); WriteLiteral("Preview"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 47 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" WriteLiteral(user.Id); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-status", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["status"] = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1608, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1639, 117, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "c32dc52b75c6f67b04b8f494002949e7e0bbd0c117321", async() => { BeginContext(1714, 38, true); WriteLiteral("<font color=\"red\">Shopping List</font>"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_5.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-rid", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 48 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" WriteLiteral(user.Id); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["rid"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-rid", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["rid"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1756, 30, true); WriteLiteral("</td>\r\n </tr>\r\n"); EndContext(); #line 50 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\GetRecipes.cshtml" } } #line default #line hidden BeginContext(1812, 41, true); WriteLiteral(" </tbody>\r\n</table>\r\n<p align=\"right\">"); EndContext(); BeginContext(1853, 88, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "c32dc52b75c6f67b04b8f494002949e7e0bbd0c120286", async() => { BeginContext(1923, 14, true); WriteLiteral("View Favorites"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_6.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = (string)__tagHelperAttribute_7.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_7); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1941, 23, true); WriteLiteral("</p>\r\n<p align=\"right\">"); EndContext(); BeginContext(1964, 60, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "c32dc52b75c6f67b04b8f494002949e7e0bbd0c122408", async() => { BeginContext(2016, 4, true); WriteLiteral("Back"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_8.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(2024, 4, true); WriteLiteral("</p>"); EndContext(); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 2 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" ViewData["Title"] = "Favorite"; #line default #line hidden BeginContext(106, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(257, 77, true); WriteLiteral("\r\n<h1>Favorite</h1>\r\n\r\n<div class=\"col-xs-12\" style=\"height:50px;\"></div>\r\n\r\n"); EndContext(); #line 16 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" if (ViewBag.message == -1) { #line default #line hidden BeginContext(366, 73, true); WriteLiteral(" <p><b><font color=\"green\">Recipe added to favourites</font></b></p>\r\n"); EndContext(); #line 19 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" } #line default #line hidden #line 20 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" if (ViewBag.message == -2) { #line default #line hidden BeginContext(474, 73, true); WriteLiteral(" <p><b><font color=\"red\">Recipe already in favourites</font></b></p>\r\n"); EndContext(); #line 23 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" } #line default #line hidden #line 24 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" if (ViewBag.message == -3) { #line default #line hidden BeginContext(582, 75, true); WriteLiteral(" <p><b><font color=\"red\">Recipe removed from favourites</font></b></p>\r\n"); EndContext(); #line 27 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" } #line default #line hidden BeginContext(660, 264, true); WriteLiteral(@" <table class=""table""> <thead> <tr> <th scope=""col"">Name</th> <th scope=""col"">Dificulty</th> <th scope=""col"">Nutrition</th> <th scope=""col"">Category</th> </tr> </thead> <tbody> "); EndContext(); #line 39 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" foreach (var user in Model) { UserViewController cc = new UserViewController(); List <IngQtd> lista = cc.getListaCompras(user.Receitaid, User.Identity.Name); if (lista.Count == 0) { #line default #line hidden BeginContext(1178, 46, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(1225, 17, false); #line 47 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" Write(user.Receita.Nome); #line default #line hidden EndContext(); BeginContext(1242, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1274, 24, false); #line 48 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" Write(user.Receita.Dificuldade); #line default #line hidden EndContext(); BeginContext(1298, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1330, 21, false); #line 49 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" Write(user.Receita.Nutricao); #line default #line hidden EndContext(); BeginContext(1351, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1383, 32, false); #line 50 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" Write(user.Receita.Categoria.Descricao); #line default #line hidden EndContext(); BeginContext(1415, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1446, 112, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "60cd964568a003a440960476d92524bd3da7d44d10512", async() => { BeginContext(1547, 7, true); WriteLiteral("Preview"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 51 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" WriteLiteral(user.Receitaid); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-status", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["status"] = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1558, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1589, 139, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "60cd964568a003a440960476d92524bd3da7d44d13656", async() => { BeginContext(1713, 11, true); WriteLiteral("Unfavourite"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-usrId", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 52 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" WriteLiteral(user.Utilizadorid); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["usrId"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-usrId", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["usrId"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); #line 52 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" WriteLiteral(user.Receitaid); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["recId"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-recId", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["recId"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1728, 30, true); WriteLiteral("</td>\r\n </tr>\r\n"); EndContext(); #line 54 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" } if (lista.Count > 0) { #line default #line hidden BeginContext(1822, 16, true); WriteLiteral(" <td>"); EndContext(); BeginContext(1839, 17, false); #line 57 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" Write(user.Receita.Nome); #line default #line hidden EndContext(); BeginContext(1856, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1880, 24, false); #line 58 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" Write(user.Receita.Dificuldade); #line default #line hidden EndContext(); BeginContext(1904, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1928, 21, false); #line 59 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" Write(user.Receita.Nutricao); #line default #line hidden EndContext(); BeginContext(1949, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1973, 32, false); #line 60 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" Write(user.Receita.Categoria.Descricao); #line default #line hidden EndContext(); BeginContext(2005, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(2028, 112, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "60cd964568a003a440960476d92524bd3da7d44d18906", async() => { BeginContext(2129, 7, true); WriteLiteral("Preview"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 61 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" WriteLiteral(user.Receitaid); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-status", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["status"] = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(2140, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(2163, 139, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "60cd964568a003a440960476d92524bd3da7d44d22034", async() => { BeginContext(2287, 11, true); WriteLiteral("Unfavourite"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-usrId", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 62 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" WriteLiteral(user.Utilizadorid); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["usrId"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-usrId", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["usrId"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); #line 62 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" WriteLiteral(user.Receitaid); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["recId"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-recId", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["recId"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(2302, 23, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(2325, 124, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "60cd964568a003a440960476d92524bd3da7d44d25432", async() => { BeginContext(2407, 38, true); WriteLiteral("<font color=\"red\">Shopping List</font>"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_5.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_6.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-rid", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 63 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" WriteLiteral(user.Receitaid); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["rid"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-rid", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["rid"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(2449, 7, true); WriteLiteral("</td>\r\n"); EndContext(); #line 64 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\ReceitaView\Favorite.cshtml" } } #line default #line hidden BeginContext(2474, 53, true); WriteLiteral(" </tbody>\r\n </table>\r\n <p align=\"right\">"); EndContext(); BeginContext(2527, 61, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "60cd964568a003a440960476d92524bd3da7d44d28376", async() => { BeginContext(2580, 4, true); WriteLiteral("Back"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_5.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_7.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_7); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(2588, 4, true); WriteLiteral("</p>"); EndContext(); }
public static UserViewController Fixture() { UserViewController controller = new UserViewController(new UserViewRepository(), "", new LoginView()); return controller; }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { #line 2 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" ViewData["Title"] = "atualizaDespensa"; #line default #line hidden BeginContext(103, 2, true); WriteLiteral("\r\n"); EndContext(); BeginContext(254, 159, true); WriteLiteral("\r\n<h1>Storeroom</h1>\r\n<p> This section allows you to update the ingredients in your storeroom. This way you know what recipes you can prepare right away.</p>\r\n"); EndContext(); #line 14 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" if (ViewBag.State == -20) { #line default #line hidden BeginContext(444, 77, true); WriteLiteral(" <p><b><font color=\"green\">Ingredients added to storeroom</font></b></p>\r\n"); EndContext(); #line 17 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" } #line default #line hidden #line 18 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" if (ViewBag.State == -10) { #line default #line hidden BeginContext(555, 57, true); WriteLiteral(" <p><b><font color=\"red\">Not a number</font></b></p>\r\n"); EndContext(); #line 21 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" } #line default #line hidden BeginContext(615, 282, true); WriteLiteral(@"<div class=""col-xs-12"" style=""height:50px;""></div> <table class=""table""> <thead> <tr> <th scope=""col"">Name</th> <th scope=""col"">Current Amount</th> <th scope=""col"">Quantity to Add</th> </tr> </thead> <tbody> "); EndContext(); #line 32 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" foreach (var user in Model) { UserViewController cc = new UserViewController(); int qq = cc.getIngQuantidade(user.Id, User.Identity.Name); #line default #line hidden #line 37 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" using (Html.BeginForm("Add", "UserView", new { id = user.Id }, FormMethod.Post)) { #line default #line hidden BeginContext(1193, 46, true); WriteLiteral(" <tr>\r\n <td>"); EndContext(); BeginContext(1240, 9, false); #line 40 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" Write(user.Nome); #line default #line hidden EndContext(); BeginContext(1249, 31, true); WriteLiteral("</td>\r\n <td>"); EndContext(); BeginContext(1281, 2, false); #line 41 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" Write(qq); #line default #line hidden EndContext(); BeginContext(1283, 198, true); WriteLiteral("</td>\r\n <td><input type=\"text\" name=\"quantidade\" id=\"quantidade\" placeholder=\"0\" /></td>\r\n <td><input type=\"submit\" value=\"add\" /></td>\r\n </tr>\r\n"); EndContext(); #line 45 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" } #line default #line hidden #line 45 "C:\Users\ASUS\source\repos\WebApplication3\WebApplication3\Views\UserView\atualizaDespensa.cshtml" } #line default #line hidden BeginContext(1507, 43, true); WriteLiteral(" </tbody>\r\n</table>\r\n\r\n<p align=\"right\">"); EndContext(); BeginContext(1550, 60, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "81179c431cbe5011544bb06e9e5070cf8ca99e708409", async() => { BeginContext(1602, 4, true); WriteLiteral("Back"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1610, 6, true); WriteLiteral("</p>\r\n"); EndContext(); }