Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 12, 2012 06:11 AM by rajish
Member
199 Points
228 Posts
Nov 29, 2012 04:40 PM|LINK
Hi, how do you do NUNIT
TestCase
like this with MSTEST
[Test] [TestCase("jpg")] [TestCase("jpeg")] [TestCase("gif")] [TestCase("png")] [TestCase("JPG")] [TestCase("JPEG")] [TestCase("GIF")] [TestCase("PNG")] public void IsImageReturnsTrueOnValidExtension(string suffix) { Mock<HttpPostedFileBase> mockPostedFile = new Mock<HttpPostedFileBase>(); mockPostedFile.SetupGet(x => x.ContentType).Returns("invalid"); mockPostedFile.SetupGet(x => x.FileName).Returns(String.Format("somefilename.{0}", suffix)); Assert.IsTrue(FileUtils.IsImage(mockPostedFile.Object)); }
Dec 01, 2012 11:10 AM|LINK
Any ideas? there must be a way to have multiple tests run with different n params, better than have n assert statements to test similar logic
424 Points
89 Posts
Dec 12, 2012 06:11 AM|LINK
please refer those to work with your test
http://www.codeproject.com/Articles/178635/Unit-Testing-Using-NUnit
http://stackoverflow.com/questions/1382313/how-do-i-specify-test-method-parameters-with-testdriven-net
QuantumInfor...
Member
199 Points
228 Posts
TestCase equivelent in MSTEST
Nov 29, 2012 04:40 PM|LINK
Hi, how do you do NUNIT
like this with MSTEST
[Test] [TestCase("jpg")] [TestCase("jpeg")] [TestCase("gif")] [TestCase("png")] [TestCase("JPG")] [TestCase("JPEG")] [TestCase("GIF")] [TestCase("PNG")] public void IsImageReturnsTrueOnValidExtension(string suffix) { Mock<HttpPostedFileBase> mockPostedFile = new Mock<HttpPostedFileBase>(); mockPostedFile.SetupGet(x => x.ContentType).Returns("invalid"); mockPostedFile.SetupGet(x => x.FileName).Returns(String.Format("somefilename.{0}", suffix)); Assert.IsTrue(FileUtils.IsImage(mockPostedFile.Object)); }QuantumInfor...
Member
199 Points
228 Posts
Re: TestCase equivelent in MSTEST
Dec 01, 2012 11:10 AM|LINK
Any ideas? there must be a way to have multiple tests run with different n params, better than have n assert statements to test similar logic
rajish
Member
424 Points
89 Posts
Re: TestCase equivelent in MSTEST
Dec 12, 2012 06:11 AM|LINK
please refer those to work with your test
http://www.codeproject.com/Articles/178635/Unit-Testing-Using-NUnit
http://stackoverflow.com/questions/1382313/how-do-i-specify-test-method-parameters-with-testdriven-net