Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed tests after adding dynamic settings.

  • Loading branch information...
commit 5d5702dfcc7b40d5fa2877400ec965167a628a57 1 parent a36337d
Tom Miller tommiller85 authored
5 src/Ideastrike.Nancy/Modules/AdminModule.cs
View
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Net;
using Ideastrike.Nancy.Models;
@@ -64,7 +65,7 @@ public AdminModule(IdeastrikeContext dbContext, Settings settings, IUserReposito
m.WelcomeMessage = _settings.WelcomeMessage;
m.HomePage = _settings.HomePage;
m.GAnalyticsKey = _settings.GAnalyticsKey;
- m.MaxThumbnailWidth = settings.MaxThumbnailWidth;
+ m.MaxThumbnailWidth = _settings.MaxThumbnailWidth;
return View["Admin/Settings", m];
};
@@ -76,7 +77,7 @@ public AdminModule(IdeastrikeContext dbContext, Settings settings, IUserReposito
_settings.Name = Request.Form.yourname;
_settings.HomePage = Request.Form.homepage;
_settings.GAnalyticsKey = Request.Form.analyticskey;
- settings.MaxThumbnailWidth = Request.Form.maxthumbnailwidth;
+ _settings.MaxThumbnailWidth = Request.Form.maxthumbnailwidth;
return Response.AsRedirect("/admin/settings");
};
4 src/Ideastrike.Nancy/Modules/IdeaModule.cs
View
@@ -77,9 +77,9 @@ public IdeaModule(IIdeaRepository ideas, IUserRepository users, Settings setting
{
var drawingImage = System.Drawing.Image.FromStream(memoryStream);
int thumbWidth = (int)parameters.width;
- if (thumbWidth > settings.MaxThumbnailWidth)
+ if (thumbWidth > int.Parse(_settings.MaxThumbnailWidth))
{
- thumbWidth = settings.MaxThumbnailWidth;
+ thumbWidth = int.Parse(_settings.MaxThumbnailWidth);
}
var thumb = drawingImage.ToThumbnail(thumbWidth);
using (var thumbnailStream = new MemoryStream())
2  tests/IdeaStrike.Tests/IdeaModuleTests/when_viewing_an_image_thumbnail_with_width_greater_than_max.cs
View
@@ -22,7 +22,7 @@ public when_viewing_an_image_thumbnail_with_width_greater_than_max()
IdeaId = 1
};
_Images.Setup(i => i.Get(1)).Returns(testImage);
- _Settings.SetupGet(s => s.MaxThumbnailWidth).Returns(1000);
+ _Settings.Setup(s => s.Get("MaxThumbnailWidth")).Returns("1000");
Get("/idea/imagethumb/1/5000000");
}
2  tests/IdeaStrike.Tests/IdeaModuleTests/when_viewing_an_image_thumbnail_with_width_less_than_max.cs
View
@@ -22,7 +22,7 @@ public when_viewing_an_image_thumbnail_with_width_less_than_max()
IdeaId = 1
};
_Images.Setup(i => i.Get(1)).Returns(testImage);
- _Settings.SetupGet(s => s.MaxThumbnailWidth).Returns(1000);
+ _Settings.Setup(s => s.Get("MaxThumbnailWidth")).Returns("1000");
Get("/idea/imagethumb/1/500");
}
1  tests/IdeaStrike.Tests/IdeaStrikeSpecBase.cs
View
@@ -10,6 +10,7 @@
using Ideastrike.Nancy.Models;
using Ideastrike.Nancy.Models.Repositories;
using Moq;
+using Nancy;
using Nancy.Responses;
using Nancy.Testing;
using Nancy.ViewEngines;
Please sign in to comment.
Something went wrong with that request. Please try again.