tdd

EF4 Code First, TDD, CRUD, and Transactions

故事扮演 提交于 2019-12-21 02:56:25
问题 In the past, I've written unit tests for simple CRUD operations when creating data access/repository code that look something like this: using(var connection = new WhateverConnection(connectionString)) { connection.Open(); using(var transaction = connection.BeginTransaction()) { try { //test the CRUD operation } finally { //gets rid of any stuff created during the test transaction.Rollback(); } } } I was messing around with EF4 Code First today, and I realized that I have no idea how this

How do I unit test the methods in a method object?

核能气质少年 提交于 2019-12-21 01:47:07
问题 I've performed the "Replace Method with Method Object" refactoring described by Beck. Now, I have a class with a "run()" method and a bunch of member functions that decompose the computation into smaller units. How do I test those member functions? My first idea is that my unit tests be basically copies of the "run()" method (with different initializations), but with assertions between each call to the member functions to check the state of the computation. (I'm using Python and the unittest

Open source projects that demonstrate TDD and SOLID priciples [closed]

房东的猫 提交于 2019-12-20 17:39:23
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I asked a similar question before, and got some good answers, but I think it was too general. Examples of great software design and implementation Does anyone know of any open-source projects that demonstrate really good TDD practices, and SOLID principles? TDD and SOLID are widely publicized, but I've never

Open source projects that demonstrate TDD and SOLID priciples [closed]

旧时模样 提交于 2019-12-20 17:38:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I asked a similar question before, and got some good answers, but I think it was too general. Examples of great software design and implementation Does anyone know of any open-source projects that demonstrate really good TDD practices, and SOLID principles? TDD and SOLID are widely publicized, but I've never

What are the pitfalls of test after development?

拟墨画扇 提交于 2019-12-20 15:24:02
问题 Recently I was assigned to a project which was already in its midway. It was TDD environment. Everyone was following right principle of Code Unit Test First and Implementation code later. But couple were doing in reverse, implementation code first and unit test later. Though on a debate they say either way its similiar. What are potential issues may arise if implementation code first and unit test later is followed? 回答1: Overengineering - you may have written more code than you actually need.

TDD/Testing CSS and HTML? [closed]

萝らか妹 提交于 2019-12-20 14:19:39
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . IS there a way to test CSS and HTML? For instance: sometimes some of the notices get affected by some CSS changes. I don't want to be testing all the notices by hand every time I do a change. Thanks 回答1: It's very difficult to automate testing of layout. But it's not too difficult

Should I use specflow at unit test level? [duplicate]

落花浮王杯 提交于 2019-12-20 12:24:12
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: SpecFlow/BDD for Unit Tests? Over the last few years I have worked in TDD using NUnit/Moq and over the last few months I have been getting to grips with BDD using mSpec. So far so good but we now want to move more into acceptance criteria based tests where the business analysts are involved and we get an outside in development process. So now we have predefined Gherkin syntax files and with specflow it feels the

NUnit Categories in combination?

假装没事ソ 提交于 2019-12-20 11:20:32
问题 In my NUnit testfixtrues i have something along the lines of [Test,Category("catA")] public void test1 { // } [Test,Category("catB")] public void test2 { // } [Test,Category("catA")] [Test,Category("catB")] public void test3 { // } Now in the NUnit gui i want to be able to select catA and catB and run the tests where catA and catB are present. Currently this is not the case and NUnit will run all 3 tests. Is there any way to change this behavior to an AND condition rather than OR? I'm

Asserting that a method is called exactly one time

拈花ヽ惹草 提交于 2019-12-20 11:12:54
问题 I want to assert that a method is called exactly one time. I'm using RhinoMocks 3.5. Here's what I thought would work: [Test] public void just_once() { var key = "id_of_something"; var source = MockRepository.GenerateStub<ISomeDataSource>(); source.Expect(x => x.GetSomethingThatTakesALotOfResources(key)) .Return(new Something()) .Repeat.Once(); var client = new Client(soure); // the first call I expect the client to use the source client.GetMeMyThing(key); // the second call the result should

TDD: What is best practice to test DataAnnotations in ASP.NET MVC 3?

☆樱花仙子☆ 提交于 2019-12-20 10:44:11
问题 I'm participating in a project using ASP.NET MVC 3 and DataAnnotations. We have DataAnnotations in ViewModels classes. How do you write unit tests for these validations? ViewModel example: public class AchievementVM { [Required(ErrorMessage = "The title field is required.")] [StringLength(100, ErrorMessage = "Title must be 100 characters or less.")] public string Title { get; set; } } Thanks! 回答1: The .NET framework comes with a Validator class which can exercise your validation logic in