public void Prepend_IsLazy()
            {
                var fixture = new BaseFixture();
                var breakingSequence = fixture.Create<BreakingSequence<object>>();

                Assert.That(() => breakingSequence.Prepend(breakingSequence), Throws.Nothing);
            }
            public void ToEnumerable_OnObject_CreatesEnumerable()
            {
                var fixture = new BaseFixture();
                var objectValue = fixture.Create<object>();

                Assert.That(() => objectValue.ToEnumerable(), Is.InstanceOf<IEnumerable<object>>());
            }
            public void NullableMin_OnNullSequence_WithSelector_ThrowsValidationException()
            {
                IEnumerable<GenericComparableStruct> nullSequence = null;
                var fixture = new BaseFixture();
                var selector = fixture.Create<Func<GenericComparableStruct, GenericComparableStruct>>();

                Assert.That(() => nullSequence.NullableMin(selector), Throws.TypeOf<ValidationException>().With.InnerException.TypeOf<ArgumentNullException>());
            }
            public void ContainsExactly_OnEmptySequence_OnZero_MeetsPredicate_ReturnsTrue()
            {
                var fixture = new BaseFixture();
                var emptySequence = Enumerable.Empty<object>();
                var predicate = fixture.Create<Func<object, bool>>();

                Assert.That(() => emptySequence.ContainsExactly(0, predicate), Is.True);
            }
            public void Append_OnEmptySequence_WithElement_ReturnsSequenceWithElement()
            {
                var emptySequence = Enumerable.Empty<object>();
                var fixture = new BaseFixture();
                var objectValue = fixture.Create<object>();

                Assert.That(() => emptySequence.Append(objectValue), Is.EqualTo(objectValue.ToEnumerable()));
            }
        public void ContainsOnlyOne_OnNullSequence_WithMeetsPredicate_ThrowsValidationException()
        {
            IEnumerable<object> nullSequence = null;
            var fixture = new BaseFixture();
            var predicate = fixture.Create<Func<object, bool>>();

            Assert.That(() => nullSequence.ContainsOnlyOne(predicate), Throws.TypeOf<ValidationException>().With.InnerException.TypeOf<ArgumentNullException>());
        }
            public void Append_OnNullSequence_WithElelment_ThrowsValidationException()
            {
                IEnumerable<object> nullSequence = null;
                var fixture = new BaseFixture();
                var objectValue = fixture.Create<object>();

                Assert.That(() => nullSequence.Append(objectValue), Throws.TypeOf<ValidationException>().With.InnerException.TypeOf<ArgumentNullException>());
            }
            public void NullableMin_OnEmptySequence_WithSelector_ReturnsNull()
            {
                var emptySequence = Enumerable.Empty<GenericComparableStruct>();
                var fixture = new BaseFixture();
                var selector = fixture.Create<Func<GenericComparableStruct, GenericComparableStruct>>();

                Assert.That(() => emptySequence.NullableMin(selector), Is.Null);
            }
            public void Shuffle_OnEmptySequence_WithRandom_ReturnsEmptySequence()
            {
                var emptySequence = Enumerable.Empty<object>();
                var fixture = new BaseFixture();
                var random = fixture.Create<Random>();

                Assert.That(() => emptySequence.Shuffle(random), Is.Empty);
            }
            public void Shuffle_OnNullSequence_WithRandom_ThrowsValidationException()
            {
                IEnumerable<object> nullSequence = null;
                var fixture = new BaseFixture();
                var random = fixture.Create<Random>();

                Assert.That(() => nullSequence.Shuffle(random), Throws.TypeOf<ValidationException>().With.InnerException.TypeOf<ArgumentNullException>());
            }
            public void Exclude_OnEmptySequence_WithPredicate_ReturnsEmptySequence()
            {
                var emptySequence = Enumerable.Empty<object>();
                var fixture = new BaseFixture();
                var objectFunc = fixture.Create<Func<object, bool>>();

                Assert.That(() => emptySequence.Exclude(objectFunc), Is.Empty);
            }
            public void RandomElement_OnEmptySequence_ThrowsValidationException()
            {
                var fixture = new BaseFixture();
                var random = fixture.Create<Random>();
                var emptySequence = Enumerable.Empty<object>();

                Assert.That(() => emptySequence.RandomElement(random), Throws.TypeOf<ValidationException>().With.InnerException.TypeOf<ArgumentException>());
            }
            public void Replace_OnEmptySequence_WithElement_WithReplacement_ReturnsEmptySequence()
            {
                var emptySequence = Enumerable.Empty<object>();
                var fixture = new BaseFixture();
                var objectValue = fixture.Create<object>();

                Assert.That(() => emptySequence.Replace(objectValue, objectValue), Is.Empty);
            }
            public void ContainsAny_OnCharacter_OnEmptyString_ReturnsFalse()
            {
                var emptyString = string.Empty;
                var fixture = new BaseFixture();
                var charValue = fixture.Create<char>();

                Assert.That(() => emptyString.ContainsAny(charValue), Is.False);
            }
        public void ContainsOnlyOne_OnEmptySequence_MeetsPredicate_ReturnsFalse()
        {
            var fixture = new BaseFixture();
            var emptySequence = Enumerable.Empty<object>();
            var predicate = fixture.Create<Func<object, bool>>();

            Assert.That(() => emptySequence.ContainsOnlyOne(predicate), Is.False);
        }
            public void ContainsAny_OnCharacter_OnNullString_ThrowsValidationException()
            {
                string nullString = null;
                var fixture = new BaseFixture();
                var charValue = fixture.Create<char>();

                Assert.That(() => nullString.ContainsAny(charValue), Throws.TypeOf<ValidationException>().With.InnerException.TypeOf<ArgumentNullException>());
            }
            public void DistinctBy_IsLazy()
            {
                var fixture = new BaseFixture();
                var breakingSequence = fixture.Create<BreakingSequence<object>>();

                var objectFunc = fixture.Create<Func<object, object>>();

                Assert.That(() => breakingSequence.DistinctBy(objectFunc), Throws.Nothing);
            }
            public void ToString_OnEmptySequence_WithProjection_WithNullSeparator_ReturnsEmptyString()
            {
                var emptySequence = Enumerable.Empty<object>();
                var fixture = new BaseFixture();
                var projection = fixture.Create<Func<object, string>>();
                string nullSeparator = null;

                Assert.That(() => emptySequence.ToString(projection, nullSeparator), Is.Empty);
            }
            public void Replace_OnEmptySequence_WithElement_WithNullProjection_ThrowsValidationException()
            {
                var emptySequence = Enumerable.Empty<object>();
                var fixture = new BaseFixture();
                var objectValue = fixture.Create<object>();
                Func<object, object> nullFunc = null;

                Assert.That(() => emptySequence.Replace(objectValue, nullFunc), Throws.TypeOf<ValidationException>().With.InnerException.TypeOf<ArgumentNullException>());
            }
            public void Truncate_OnString_LengthIsGreaterThanElpises_ReturnsString()
            {
                var fixture = new BaseFixture();
                var charValue = fixture.Create<char>();
                var maxLength = ValidLength - 1;
                var shortString = new string(charValue, maxLength);

                Assert.That(() => shortString.Truncate(ValidLength + 1), Is.EqualTo(shortString));
            }
            public void ToOrOther_ToObject_OnEmptyStringWithObject_OutStringAsObject()
            {
                var emptyStrying = string.Empty;
                var fixture = new BaseFixture();
                var objectValue = fixture.Create<object>();
                object outParameter;
                emptyStrying.ToOrOther(out outParameter, objectValue);

                Assert.That(() => outParameter, Is.EqualTo(emptyStrying));
            }
            public void AddLine_OnGoodStringBuilder_WithEmptyString_NoLineWriter_ReturnsStringBuilder()
            {
                var fixture = new BaseFixture();
                var stringBuilder = fixture.Create<StringBuilder>();
                var emptyString = string.Empty;

                var actual = stringBuilder.AddLine(emptyString);

                Assert.That(() => actual, Is.EqualTo(stringBuilder));
            }
            public void AddLine_OnGoodStringBuilder_WithEmptyString_WithLineWriter_CallsWriteLine()
            {
                var mockLineWriter = new Mock<ILineWriter>(MockBehavior.Strict);
                var emptyString = string.Empty;
                var fixture = new BaseFixture();
                var stringBuilder = fixture.Create<StringBuilder>();
                mockLineWriter.Setup(m => m.WriteLine());
                ILineWriter lineWriter = mockLineWriter.Object;
                stringBuilder.AddLine(emptyString, lineWriter);

                mockLineWriter.Verify(m => m.WriteLine(), Times.Once());
            }
            public void AverageOrDefault_OnEmptyIntSequence_WithDecimalFunc_ReturnsDefaultDecimal()
            {
                var fixture = new BaseFixture();
                var emptyIntSequence = Enumerable.Empty<int>();
                var decimalFunc = fixture.Create<Func<int, decimal>>();

                Assert.That(() => emptyIntSequence.AverageOrDefault(decimalFunc), Is.EqualTo(default(decimal)));
            }
            public void AverageOrDefault_OnEmptyIntSequence_WithNullableLongFunc_ReturnsDefaultLong()
            {
                var fixture = new BaseFixture();
                var emptyIntSequence = Enumerable.Empty<int>();
                var nullableLongFunc = fixture.Create<Func<int, long?>>();

                Assert.That(() => emptyIntSequence.AverageOrDefault(nullableLongFunc), Is.EqualTo(default(long)));
            }
            public void AverageOrDefault_OnNullIntSequence_WithIntFunc_ReturnsDefaultInt()
            {
                IEnumerable<int> nullIntSequence = null;
                var fixture = new BaseFixture();
                var intFunc = fixture.Create<Func<int, int>>();

                Assert.That(() => nullIntSequence.AverageOrDefault(intFunc), Is.EqualTo(default(int)));
            }
            public void IsEmpty_OnNonGenericEnumerableSingleItem_ReturnsFalse()
            {
                var fixture = new BaseFixture();
                var mock = fixture.Create<Mock<IEnumerable>>();
                mock.Setup(m => m.GetEnumerator()).Returns(fixture.Create<object>().ToEnumerable().GetEnumerator);
                IEnumerable sequence = mock.Object;

                Assert.That(() => sequence.IsEmpty(), Is.False);
            }
            public void IsEmpty_OnNonGenericCollectionSingleItem_ReturnsFalse()
            {
                var fixture = new BaseFixture();
                var mock = new Mock<ICollection>();
                mock.Setup(m => m.Count).Returns(1);
                mock.Setup(m => m.GetEnumerator()).Returns(fixture.Create<object>().ToEnumerable().GetEnumerator);
                ICollection singleItemNonGenericCollection = mock.Object;

                Assert.That(() => singleItemNonGenericCollection.IsEmpty(), Is.False);
            }
            public void AverageOrDefault_OnNullIntSequence_WithNullableDoubleFunc_ReturnsDefaultDouble()
            {
                IEnumerable<int> nullIntSequence = null;
                var fixture = new BaseFixture();
                var nullableDoubleFunc = fixture.Create<Func<int, double?>>();

                Assert.That(() => nullIntSequence.AverageOrDefault(nullableDoubleFunc), Is.EqualTo(default(double)));
            }
            public void AverageOrDefault_OnEmptyIntSequence_WithFloatFunc_ReturnsDefaultFloat()
            {
                var fixture = new BaseFixture();
                var emptyIntSequence = Enumerable.Empty<int>();
                var floatFunc = fixture.Create<Func<int, float>>();

                Assert.That(() => emptyIntSequence.AverageOrDefault(floatFunc), Is.EqualTo(default(float)));
            }