Esempio n. 1
0
        public void op_Format_int_int()
        {
            const string expected = "CavityHttpClient/1.0 (+http://code.google.com/p/cavity/)";
            var          actual   = UserAgent.Format(1, 0);

            Assert.Equal(expected, actual);
        }
Esempio n. 2
0
        public void op_Format()
        {
            var expected = "CavityHttpClient/{0}.{1} (+http://code.google.com/p/cavity/)".FormatWith(
                Assembly.GetExecutingAssembly().GetName().Version.Major,
                Assembly.GetExecutingAssembly().GetName().Version.Minor);
            var actual = UserAgent.Format();

            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
 public void prop_Value()
 {
     Assert.True(new PropertyExpectations <UserAgent>(p => p.Value)
                 .TypeIs <string>()
                 .DefaultValueIs(UserAgent.Format())
                 .ArgumentNullException()
                 .Set("value")
                 .IsNotDecorated()
                 .Result);
 }
Esempio n. 4
0
        public void prop_UserAgent()
        {
            try
            {
                var locator = new Mock <IServiceLocator>();
                ServiceLocator.SetLocatorProvider(() => locator.Object);

                Assert.True(new PropertyExpectations <HttpClient>(p => p.UserAgent)
                            .TypeIs <string>()
                            .DefaultValueIs(UserAgent.Format())
                            .IsNotDecorated()
                            .Result);

                locator.VerifyAll();
            }
            finally
            {
                ServiceLocator.SetLocatorProvider(null);
            }
        }