Пример #1
0
        public void Can_not_build_when_no_values_are_defined()
        {
            var sut = new SafeFakeObjectBuilder();

            Assert.False(sut.CanBuild());
            Assert.Throws <CanNotBuildException <SafeFakeObjectBuilder> >(() => sut.Build());
        }
Пример #2
0
        public void Can_not_build_when_string_is_not_defined_as_specified_in_GetBuildErrors()
        {
            var sut = new SafeFakeObjectBuilder();

            Assert.False(sut.CanBuild());
            Assert.Throws <CanNotBuildException <SafeFakeObjectBuilder> >(() => sut.Build());
        }
Пример #3
0
        public void Can_build_when_value_is_set_for_SomeInt(int someIntValue)
        {
            var sut = new SafeFakeObjectBuilder()
                      .With(x => x.String, "Some string")
                      .With(x => x.SomeInt, someIntValue);

            Assert.True(sut.CanBuild());
        }
Пример #4
0
        public void Can_build_when_string_is_defined_as_specified_in_GetBuildErrors()
        {
            var expectedValue = "ExpectedValue";
            var sut           = new SafeFakeObjectBuilder();

            sut.With(x => x.String, expectedValue).With(x => x.SomeInt, 0);
            Assert.True(sut.CanBuild());
            Assert.Equal(expectedValue, sut.Build().String);
        }
Пример #5
0
        public void Can_not_build_when_no_value_set_for_SomeInt()
        {
            var sut = new SafeFakeObjectBuilder()
                      .With(x => x.String, "Some string");
            var exceptions = sut.GetBuildErrors();

            Assert.False(sut.CanBuild());
            Assert.Throws <CanNotBuildException <SafeFakeObjectBuilder> >(() => sut.Build());
        }