예제 #1
0
        public static void Create___Should_not_throw___When_called_with_null_container()
        {
            // Arrange
            var systemUnderTest = new RandomBoolSequenceGenerator();
            var dummyRequest    = new object();

            // Act
            var ex = Record.Exception(() => systemUnderTest.Create(dummyRequest, null));

            // Assert
            ex.Should().BeNull();
        }
예제 #2
0
        public static void Create___Should_return_an_object_of_type_bool___When_request_is_for_a_boolean()
        {
            // Arrange
            var dummyContainer  = new DummySpecimenContext();
            var systemUnderTest = new RandomBoolSequenceGenerator();
            var request         = typeof(bool);

            // Act
            var actualResult = systemUnderTest.Create(request, dummyContainer);

            // Assert
            actualResult.Should().BeOfType <bool>();
        }
예제 #3
0
        public static void Create___Should_return_an_object_equal_to_NoSpecimen___When_called_with_null_request()
        {
            // Arrange
            var dummyContainer  = new DummySpecimenContext();
            var systemUnderTest = new RandomBoolSequenceGenerator();
            var expectedResult  = new NoSpecimen();

            // Act
            var actualResult = systemUnderTest.Create(null, dummyContainer);

            // Assert
            actualResult.Should().Be(expectedResult);
        }
예제 #4
0
        public static void Create___Should_return_both_true_and_false_at_least_once___When_many_requests_are_made_for_booleans()
        {
            // Arrange
            var dummyContainer  = new DummySpecimenContext();
            var systemUnderTest = new RandomBoolSequenceGenerator();
            var request         = typeof(bool);

            // Act
            var actualResult = Enumerable.Range(1, 1000).Select(_ => systemUnderTest.Create(request, dummyContainer)).Cast <bool>().ToList();

            // Assert
            actualResult.Should().Contain(true);
            actualResult.Should().Contain(false);
        }
예제 #5
0
        public static void Create___Should_return_random_booleans___When_multiple_requests_are_made_for_booleans()
        {
            // Arrange
            var dummyContainer   = new DummySpecimenContext();
            var systemUnderTest  = new RandomBoolSequenceGenerator();
            var request          = typeof(bool);
            var sequentialBools1 = new List <bool> {
                true, false, true, false, true, false, true, false
            };
            var sequentialBools2 = new List <bool> {
                false, true, false, true, false, true, false, true
            };

            // Act
            var actualResult = Enumerable.Range(1, sequentialBools1.Count).Select(_ => systemUnderTest.Create(request, dummyContainer)).Cast <bool>().ToList();

            // Assert
            actualResult.Should().NotEqual(sequentialBools1);
            actualResult.Should().NotEqual(sequentialBools2);
        }