asp.net-mvc-5

When unit testing, how do I mock a return null from async method?

非 Y 不嫁゛ 提交于 2020-12-29 08:59:30
问题 Normally, I mock my repo like so: var repository = new Mock<ISRepository>(); repository.Setup(r => r.GetMemberAsync(email)) .Returns(Task.FromResult(new Member { FirstName = firstName, LastName = lastName })); But, in my code, I check to see if the member is not found, i.e. GetMemberAsync returns null. How do I mock this? I tried: var repository = new Mock<ISRepository>(); repository.Setup(r => r.GetMemberAsync(email)) .Returns(Task.FromResult<object>(null)); but I get a compile error. 回答1:

Calling a Partial View

柔情痞子 提交于 2020-12-26 16:50:17
问题 I've got a View rendering two dropdownlists. The controllers for the dropdownlists work fine. They call methods in a repository class for the DB selections. Below the dropdownlists I'm trying to render a table of data in a partial view, in response to the dropdownlist selections. The dropdowns in the View use a single model: @model BudgetDemo.Models.BudgetsActualsViewModel The Partial View displaying the table data uses IEnumerable: @model IEnumerable<BudgetDemo.Models.BudgetsActualsViewModel

Calling a Partial View

删除回忆录丶 提交于 2020-12-26 16:47:13
问题 I've got a View rendering two dropdownlists. The controllers for the dropdownlists work fine. They call methods in a repository class for the DB selections. Below the dropdownlists I'm trying to render a table of data in a partial view, in response to the dropdownlist selections. The dropdowns in the View use a single model: @model BudgetDemo.Models.BudgetsActualsViewModel The Partial View displaying the table data uses IEnumerable: @model IEnumerable<BudgetDemo.Models.BudgetsActualsViewModel

Calling a Partial View

懵懂的女人 提交于 2020-12-26 16:45:18
问题 I've got a View rendering two dropdownlists. The controllers for the dropdownlists work fine. They call methods in a repository class for the DB selections. Below the dropdownlists I'm trying to render a table of data in a partial view, in response to the dropdownlist selections. The dropdowns in the View use a single model: @model BudgetDemo.Models.BudgetsActualsViewModel The Partial View displaying the table data uses IEnumerable: @model IEnumerable<BudgetDemo.Models.BudgetsActualsViewModel

Reading data from Excel sheet using entity framework

半城伤御伤魂 提交于 2020-12-26 01:51:09
问题 We have some info that is contained within an excel sheet. the excel sheet contains two columns; customer name + customer balance. Now I need to display this info inside my asp.net mvc view, basically to query the excel sheet based on the customer name and display its total balance inside my view. In this way we will be uploading the excel sheet inside our system each month or each day , and we will be querying the excel sheet instead of the DB. So is this possible using EF ? or it is better

Reading data from Excel sheet using entity framework

天大地大妈咪最大 提交于 2020-12-26 01:50:56
问题 We have some info that is contained within an excel sheet. the excel sheet contains two columns; customer name + customer balance. Now I need to display this info inside my asp.net mvc view, basically to query the excel sheet based on the customer name and display its total balance inside my view. In this way we will be uploading the excel sheet inside our system each month or each day , and we will be querying the excel sheet instead of the DB. So is this possible using EF ? or it is better

Reading data from Excel sheet using entity framework

冷暖自知 提交于 2020-12-26 01:50:54
问题 We have some info that is contained within an excel sheet. the excel sheet contains two columns; customer name + customer balance. Now I need to display this info inside my asp.net mvc view, basically to query the excel sheet based on the customer name and display its total balance inside my view. In this way we will be uploading the excel sheet inside our system each month or each day , and we will be querying the excel sheet instead of the DB. So is this possible using EF ? or it is better

How to display a text on the top of Media Player on full screen?

巧了我就是萌 提交于 2020-12-13 17:58:05
问题 Using the below code, I am getting the result when I debug but I am unable to display the Text without debug. Style sheet display:'block'; Which is unable to be removed due to this not displaying. <div class="video-overlay" id="overlayclass"></div> <video id="preview" muted style="background-color: #2a2a2a;border: 1px solid black; height: 300px; width: 100%;"></video> (I am using Getusermedia() API) function toggleFullScreen() { //var pre1 = preview.webkitDisplayingFullscreen; if (preview

How to display a text on the top of Media Player on full screen?

梦想的初衷 提交于 2020-12-13 17:57:30
问题 Using the below code, I am getting the result when I debug but I am unable to display the Text without debug. Style sheet display:'block'; Which is unable to be removed due to this not displaying. <div class="video-overlay" id="overlayclass"></div> <video id="preview" muted style="background-color: #2a2a2a;border: 1px solid black; height: 300px; width: 100%;"></video> (I am using Getusermedia() API) function toggleFullScreen() { //var pre1 = preview.webkitDisplayingFullscreen; if (preview

How to display a text on the top of Media Player on full screen?

核能气质少年 提交于 2020-12-13 17:57:22
问题 Using the below code, I am getting the result when I debug but I am unable to display the Text without debug. Style sheet display:'block'; Which is unable to be removed due to this not displaying. <div class="video-overlay" id="overlayclass"></div> <video id="preview" muted style="background-color: #2a2a2a;border: 1px solid black; height: 300px; width: 100%;"></video> (I am using Getusermedia() API) function toggleFullScreen() { //var pre1 = preview.webkitDisplayingFullscreen; if (preview