Ejemplo n.º 1
0
        public decimal ComputeInterestTest(
            [PexAssumeUnderTest] AccountService target,
            Account account,
            double annualRate,
            int months
            )
        {
            var mock = new Mock <Account>();

            mock.SetupSet(m => m.Balance = It.IsInRange(0, 1000, Range.Inclusive));
            mock.SetupSet(m => m.Id      = It.IsInRange(0, 10, Range.Inclusive));

            PexAssume.IsNotNull(account);
            PexAssume.AreEqual(mock.Object, account);
            PexAssume.IsTrue(annualRate > 0);
            PexAssume.IsTrue(annualRate < 1);
            PexAssume.IsTrue(months > 5);
            PexAssume.IsTrue(months <= 12);


            decimal result = target.ComputeInterest(account, annualRate, months);

            return(result);
            // TODO: add assertions to method AccountServiceTest.ComputeInterestTest(AccountService, Account, Double, Int32)
        }
 public void SaveAndLoadSettingsPUT1([PexAssumeUnderTest] MemorySettingsStorage storage1, [PexAssumeUnderTest] String settingName, [PexAssumeNotNull] Object settingValue)
 {
     PexAssume.IsTrue(settingName != null);
     PexAssume.IsTrue(settingValue != null);
     PexAssume.IsTrue(storage1.GetSetting(settingName) == null);
     storage1.SaveSetting(settingName, settingValue);
     PexAssume.AreEqual(settingValue, storage1.GetSetting(settingName));
 }
Ejemplo n.º 3
0
 public void TopLevelSettingsPUT1([PexAssumeUnderTest] SettingsGroup testGroup1, [PexAssumeUnderTest]
                                  String settingName, [PexAssumeNotNull] Object settingValue)
 {
     PexAssume.IsTrue(settingName != null);
     PexAssume.IsTrue(settingValue != null);
     PexAssume.IsTrue(testGroup1.GetSetting(settingName) == null);
     testGroup1.SaveSetting(settingName, settingValue);
     PexAssume.AreEqual(settingValue, testGroup1.GetSetting(settingName));
 }
 private TreeDictionary <TKey, TValue, DefaultComparer <TKey> > CreateDictionary <TKey, TValue>(
     TKey[] keys, TValue[] values) where TKey : struct
 {
     PexAssume.IsNotNull(keys);
     PexAssume.IsNotNull(values);
     PexAssume.AreEqual(keys.Length, values.Length);
     PexAssume.AreDistinctValues(keys);
     return(TreeDictionary.Empty <TKey, TValue>().AddAll(keys.Zip(values)));
 }
Ejemplo n.º 5
0
 public void CanGetTcpChannelOnSpecifiedPortPUT1([PexAssumeUnderTest] TcpChannel chan1, [PexAssumeUnderTest] TcpChannel chan2)
 {
     PexAssume.AreEqual(chan1.ChannelName, chan2.ChannelName);
     PexAssert.AreSame(chan1, chan2);
     PexAssert.AreEqual(chan1, chan2);
 }