public void ComputeApplicationNameViaApplicationBinding()
        {
            const string name = "Application Name";

            var applicationBindingMock = new Mock <IApplicationBinding <object> >();

            applicationBindingMock.Setup(m => m.Name).Returns(name);

            NamingConventionThunk.ComputeApplicationName(applicationBindingMock.Object).Should().Be(name);
        }
예제 #2
0
        public void ComputeApplicationNameViaApplicationBinding()
        {
            const string name = "Application Name";

            var applicationBindingMock = new Mock <IApplicationBinding <object> >();

            applicationBindingMock.Setup(m => m.Name).Returns(name);

            Assert.That(NamingConventionThunk.ComputeApplicationName(applicationBindingMock.Object), Is.EqualTo(name));
        }
        public void ComputeApplicationNameViaNamingConvention()
        {
            var conventionMock = new Mock <INamingConvention <object> >();

            var applicationBindingMock = new Mock <IApplicationBinding <object> >();

            applicationBindingMock.Setup(m => m.Name).Returns(conventionMock.Object);

            NamingConventionThunk.ComputeApplicationName(applicationBindingMock.Object);

            conventionMock.Verify(m => m.ComputeApplicationName(applicationBindingMock.Object), Times.Once());
        }
        public void WrapExceptionInNamingConventionException()
        {
            var conventionMock = new Mock <INamingConvention <object> >();

            conventionMock.Setup(m => m.ComputeApplicationName(It.IsAny <IApplicationBinding <object> >())).Throws <NotSupportedException>();

            var applicationBindingMock = new Mock <IApplicationBinding <object> >();

            applicationBindingMock.Setup(m => m.Name).Returns(conventionMock.Object);

            Invoking(() => NamingConventionThunk.ComputeApplicationName(applicationBindingMock.Object))
            .Should().Throw <NamingConventionException>()
            .WithInnerException <NotSupportedException>();
        }
예제 #5
0
        public void WrapExceptionInNamingConventionException()
        {
            var conventionMock = new Mock <INamingConvention <object> >();

            conventionMock.Setup(m => m.ComputeApplicationName(It.IsAny <IApplicationBinding <object> >())).Throws <NotSupportedException>();

            var applicationBindingMock = new Mock <IApplicationBinding <object> >();

            applicationBindingMock.Setup(m => m.Name).Returns(conventionMock.Object);

            Assert.That(
                () => NamingConventionThunk.ComputeApplicationName(applicationBindingMock.Object),
                Throws.TypeOf <NamingConventionException>().With.InnerException.TypeOf <NotSupportedException>());
        }