We’re rewarding the question askers & reputations are being recalculated! Read more.

6 deleted 13 characters in body; edited title

# Does this follow proper xSpec style? Unit tests for the SquishIt framework

For a little background, I'm a contributor to SquishIt and decided that I should start cleaning up the mess of unit tests (my updated version of one set of tests vs. original set of tests). After tackling only part of the "rewrite", I figured it would be a good opportunity to learn, try, and understand BDD style testing to hopefully help improve the unit tests being written and ran. I decided to go with NSpec after taking a look at some of the choices out there.

My problem is simply trying to break the tests down into the appropriate "groupings" that logically make sense and "conform" to xSpec. Here is what I've done so far and passes all tests as expected:

EDIT:

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

{
it["GroupBundles containskey default"] = () => bundle.GroupBundles.ContainsKey("default").is_true();
it["has no Assets"] = () => bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}

{
void it_should_still_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}
}


How can I improve this or am I already on the right track?

# Does this follow proper xSpec style?

For a little background, I'm a contributor to SquishIt and decided that I should start cleaning up the mess of unit tests (my updated version of one set of tests vs. original set of tests). After tackling only part of the "rewrite", I figured it would be a good opportunity to learn, try, and understand BDD style testing to hopefully help improve the unit tests being written and ran. I decided to go with NSpec after taking a look at some of the choices out there.

My problem is simply trying to break the tests down into the appropriate "groupings" that logically make sense and "conform" to xSpec. Here is what I've done so far and passes all tests as expected:

EDIT:

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

{
it["GroupBundles containskey default"] = () => bundle.GroupBundles.ContainsKey("default").is_true();
it["has no Assets"] = () => bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}

{
void it_should_still_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}
}


How can I improve this or am I already on the right track?

# Unit tests for the SquishIt framework

For a little background, I'm a contributor to SquishIt and decided that I should start cleaning up the mess of unit tests (my updated version of one set of tests vs. original set of tests). After tackling only part of the "rewrite", I figured it would be a good opportunity to learn, try, and understand BDD style testing to hopefully help improve the unit tests being written and ran. I decided to go with NSpec after taking a look at some of the choices out there.

My problem is simply trying to break the tests down into the appropriate "groupings" that logically make sense and "conform" to xSpec. Here is what I've done so far and passes all tests as expected:

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

{
it["GroupBundles containskey default"] = () => bundle.GroupBundles.ContainsKey("default").is_true();
it["has no Assets"] = () => bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}

{
void it_should_still_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}
}


How can I improve this or am I already on the right track?

5 Corrected spelling

For a little background, I'm a contributor to SquishIt and decided that I should start cleaning up the mess of unit tests (my updated version of one set of tests vs. original set of tests). After tackling only part of the "rewrite", I figured it would be a good opportunity to learn, try, and understand BDD style testing to hopefully help improve the unit tests being written and ran. I decided to go with NSpec after taking a look at some of the choices out there.

My problem is simply trying to break the tests down into the appropriate "groupings" that logically make sense and "conform" to xSpec. Here is what I've done so far and passes all tests as expected:

EDIT:

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

{
it["GroupBundles containskey default"] = () => bundle.GroupBundles.ContainsKey("default").is_true();
it["has no Assets"] = () => bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}

{
void it_should_still_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}
}


How can I improve this or am I already on the writeright track?

For a little background, I'm a contributor to SquishIt and decided that I should start cleaning up the mess of unit tests (my updated version of one set of tests vs. original set of tests). After tackling only part of the "rewrite", I figured it would be a good opportunity to learn, try, and understand BDD style testing to hopefully help improve the unit tests being written and ran. I decided to go with NSpec after taking a look at some of the choices out there.

My problem is simply trying to break the tests down into the appropriate "groupings" that logically make sense and "conform" to xSpec. Here is what I've done so far and passes all tests as expected:

EDIT:

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

{
it["GroupBundles containskey default"] = () => bundle.GroupBundles.ContainsKey("default").is_true();
it["has no Assets"] = () => bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}

{
void it_should_still_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}
}


How can I improve this or am I already on the write track?

For a little background, I'm a contributor to SquishIt and decided that I should start cleaning up the mess of unit tests (my updated version of one set of tests vs. original set of tests). After tackling only part of the "rewrite", I figured it would be a good opportunity to learn, try, and understand BDD style testing to hopefully help improve the unit tests being written and ran. I decided to go with NSpec after taking a look at some of the choices out there.

My problem is simply trying to break the tests down into the appropriate "groupings" that logically make sense and "conform" to xSpec. Here is what I've done so far and passes all tests as expected:

EDIT:

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

{
it["GroupBundles containskey default"] = () => bundle.GroupBundles.ContainsKey("default").is_true();
it["has no Assets"] = () => bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}

{
void it_should_still_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}
}


How can I improve this or am I already on the right track?

4 deleted 21 characters in body

EDIT:

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

{

it["GroupBundles containskey default"] = () => bundle.GroupBundles.ContainsKey("default").is_true();
}

it["has no Assets"] void= it_aas_no_Assets()
{
=> bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}

{
void it_should_still_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}
}

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

void it_GroupBundles_contains_key_default()
{
bundle.GroupBundles.ContainsKey("default").is_true();
}

void it_aas_no_Assets()
{
bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}

{
void it_should_still_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}
}


EDIT:

using NSpec;
using SquishIt.Framework;
using SquishIt.Framework.JavaScript;

namespace SquishIt.Tests
{
class describe_JavaScriptBundle : nspec
{
public JavaScriptBundle bundle;

{
}
}

class when_I_create_a_bundle : describe_JavaScriptBundle
{
void before_each()
{
if (bundle == null)
{
bundle = Bundle.JavaScript();
}
}

{
it["GroupBundles containskey default"] = () => bundle.GroupBundles.ContainsKey("default").is_true();
it["has no Assets"] = () => bundle.GroupBundles["default"].Assets.Count.Is(0);
}
}

{
void before_each()
{
}

void it_should_contain_only_one_file()
{
bundle.GroupBundles["default"].Assets.Count.Is(1);
}
}