Comments (12)
Hi @petrsvihlik, I'll take a look. Any preference on the test project in terms of unit testing frameworks?
from sample-app-net.
@petrsvihlik brilliant stuff. I'll update the packages and get working on this. Thanks for the information.
from sample-app-net.
I notice that the listed areas are using FirstOrDefault now - is more required to close this issue down? If so, I'm happy to contribute.
from sample-app-net.
The issue is still actual but let me rephrase it a little bit. The site should still be functional* if there are no (zero) content items of the following types:
- coffee
- brewer
- accessory
- article
- cafe
- fact about us
- grinder
- hero unit
*functional == the site doesn't throw any exceptions == all exceptions are either handled or prevented by null checks (the content is just not displayed)
from sample-app-net.
if you want to pick it up @Steve-Fenton just leave a note here, please. thanks!
from sample-app-net.
@Steve-Fenton We prefer nunit for .NET Framework and xunit for .NET Core.
If you need to reference any other library (e.g. for mocking) the rule of thumb is to use libraries that target .NET Standard. So e.g. Moq or FakeItEasy will do.
from sample-app-net.
Hi @petrsvihlik - I'm hitting a few problems creating mocks for some of the types, as they are sealed and have internal-only constructors, for example DeliveryItemListingResponse<Coffee>
. Is there any chance of getting an interface over these types... or are there any suggestions for how I could mock these types?
Thanks,
Steve
from sample-app-net.
Hi @Steve-Fenton , yes...it should be possible since yesterday :)
from sample-app-net.
Hello,
I have been testing this using a web crawler against my local instance, as the amount of changes I would have to make in order to bring the views under test is monumental.
I ran a full crawl, then started un-publishing various content items from my copy of the demo data.
The errors I found from this testing are:
- AboutUsController Line 21: null Facts -> foreach (var fact in response.Item.Facts)
Fix:
public async Task<ActionResult> Index()
{
var response = await client.GetItemAsync<AboutUs>("about_us");
var viewModel = new AboutUsViewModel
{
FactViewModels = MapFactsAboutUs(response)
};
return View(viewModel);
}
private IList<FactAboutUsViewModel> MapFactsAboutUs(DeliveryItemResponse<AboutUs> response)
{
var facts = new List<FactAboutUsViewModel>();
if (response.Item == null)
{
return facts;
}
int i = 0;
foreach (var fact in response.Item.Facts)
{
var factViewModel = new FactAboutUsViewModel
{
Fact = (FactAboutUs)fact
};
if (i++ % 2 == 0)
{
factViewModel.Odd = true;
}
facts.Add(factViewModel);
}
return facts;
}
- Contacts/Index.cshtml Line 10: null Roastery -> <li>@Html.DisplayFor(vm => vm.Roastery.Phone)</li>
Fixed by wrapping with:
@if (Model.Roastery != null) {
- Shared/DisplayTemplates/PhoneNumber.cshtml: null string
Before
string strippedDashes = Model.Replace("-", string.Empty);
After
string strippedDashes = string.IsNullOrWhiteSpace(Model) ? string.Empty : Model.Replace("-", string.Empty);
I am currently dealing with a combination of VS2015/GitHub two-factor auth problems that is preventing this local change going up to my branch, and having to look at a live issue in my day job, so I don't know when the commit is coming for this.
from sample-app-net.
@Steve-Fenton last thing before we close this issue. Could you please verify the following three scenarios?
- When home page is missing Hero image, it ends up with an unhandled exception
- When home page is missing content variants for personalization, it ends up with unhandled exception
- ContactsControler - If there are no Cafes, throws exception on .First()
They were reported some time ago so I'm not sure if they're still valid.
from sample-app-net.
- When home page is missing Hero image, it ends up with an unhandled exception
I have tested using "unpublish" on "Home page hero unit" and there are no errors.
- When home page is missing content variants for personalization, it ends up with unhandled except
I'm not sure which content to remove on this one. Can I have a hint?
- ContactsControler - If there are no Cafes, throws exception on .First()
Again, I unpublished all cafes. There is no error, although the page looks very blank.
from sample-app-net.
👏 🎉 👌 thanks for your help, @Steve-Fenton !
from sample-app-net.
Related Issues (20)
- Extract HTML helpers (edit mode panel, etc.) to a separate library HOT 13
- Unable to Deploy to AWS Bean Stalk from Bamboo HOT 1
- Localized URLs don't return expected localized pages HOT 4
- Edit Model Panel target=_blank links should have rel="noopener" added HOT 1
- Self config still shows Kentico Cloud logo HOT 1
- Building sample app on Mac OS HOT 3
- Add an example of the languages endpoint usage
- CI Build fails for PRs outside of this repo HOT 2
- Use smart-link SDK instead of custom made tag helper HOT 1
- Fill Spanish resource file
- Switching the language does not preserve current route
- Css file is missing HOT 1
- Deprecated packages upgrade HOT 1
- Use Environment ID instead of Project ID
- Include information about the "Generate Models" PS script on build
- Spike: Try deploy to zeit HOT 6
- Migrate the application to ASP.NET Core MVC HOT 11
- Error on build inheriting ICodeFirstTypeProvider in DancingGoat.Models HOT 2
- Replace hardcoded sample project items count in SelfConfigController.
- After deploying to Azure, the app returns 500 Internal server error. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sample-app-net.