public void Or_WhenInvokedShouldReturnAnInstanceWithTheSameStatusCode()
        {
            // Arrange
            var fakeITransformCollection = A.Fake<ITransformationCollection>();
            var builder = new ExceptionTransformationCollectionBuilder(fakeITransformCollection, 500);

            // Act
            var newBuilder = builder.Or<Exception>();

            // Assert
            Assert.NotNull(newBuilder);
            Assert.Same(fakeITransformCollection, newBuilder.Transformations);
        }
        public void Map_WhenInvoked_ShouldReturnAnInstanceWithTheSameITransformationCollection()
        {
            // Arrange
            var fakeITransformCollection = A.Fake<ITransformationCollection>();
            var builder = new ExceptionTransformationCollectionBuilder(fakeITransformCollection, 500);

            // Act
            var newBuilder = builder.Return(404);

            // Assert
            Assert.NotNull(newBuilder);
            Assert.Equal(fakeITransformCollection, newBuilder.Transformations);
        }
        public void Or_WhenInvoked_ShouldAddANewTransformationIntoTheCollection()
        {
            // Arrange
            var transformations = new Dictionary<Type, int>();

            var fakeITransformCollection = A.Fake<ITransformationCollection>();
            A.CallTo(() => fakeITransformCollection.AddMappingFor<Exception>(A<int>._)).Invokes((int sc) =>
            {
                transformations.Add(typeof(Exception), sc);
            });

            var builder = new ExceptionTransformationCollectionBuilder(fakeITransformCollection, 500);

            // Act
            var newBuilder = builder.Or<Exception>();

            // Assert
            A.CallTo(fakeITransformCollection).Where(call => call.Method.Name == "AddMappingFor").MustHaveHappened(Repeated.Exactly.Once);

            Assert.NotNull(newBuilder);
            Assert.Equal(1, transformations.Count);
            Assert.True(transformations.ContainsKey(typeof(Exception)));
            Assert.Equal(500, transformations[typeof(Exception)]);
        }
        public void WhenInitialized_ShouldNotModifyTheStatusCode()
        {
            // Arrange
            var fakeITransformCollection = A.Fake<ITransformationCollection>();

            // Act
            var builder = new ExceptionTransformationCollectionBuilder(fakeITransformCollection, 500);

            // Assert
            Assert.Equal(500, builder.StatusCode);
        }
        public void WhenInitialized_ShouldUseTheITransformationCollectionInstanceGiven()
        {
            // Arrange
            var fakeITransformCollection = A.Fake<ITransformationCollection>();

            // Act
            var builder = new ExceptionTransformationCollectionBuilder(fakeITransformCollection, 500);

            // Assert
            Assert.Equal(fakeITransformCollection, builder.Transformations);
        }