Exemple #1
0
        public void FromPersistedForm_ValidMilestone_GetsData()
        {
            var msg = TeamCollectionMessage.FromPersistedForm("2010-06-15T13:45:30.0000000-07:00\tReloaded");

            Assert.That(msg.When.Month, Is.EqualTo(6));
            Assert.That(msg.MessageType, Is.EqualTo(MessageAndMilestoneType.Reloaded));
            Assert.That(msg.RawEnglishMessageTemplate, Is.Null);
        }
Exemple #2
0
 private void AssertClobberMessage(TeamCollectionMessage message, string title = "I was clobbered")
 {
     Assert.That(message, Is.Not.Null);
     AssertSingleMessage(message, MessageAndMilestoneType.ClobberPending,
                         "TeamCollection.BookClobbered",
                         "The book called {0} was changed remotely, and your version has been clobbered",
                         title,
                         null);
 }
Exemple #3
0
 private static void AssertSingleMessage(TeamCollectionMessage msg, MessageAndMilestoneType expectedType,
                                         string expectedL10n, string expectedMsg, string expectedParam0, string expectedParam1)
 {
     Assert.That(msg.MessageType, Is.EqualTo(expectedType));
     Assert.That(msg.L10NId, Is.EqualTo(expectedL10n));
     Assert.That(msg.RawEnglishMessageTemplate, Is.EqualTo(expectedMsg));
     Assert.That(msg.Param0 ?? "", Is.EqualTo(expectedParam0 ?? ""));
     Assert.That(msg.Param1 ?? "", Is.EqualTo(expectedParam1 ?? ""));
 }
Exemple #4
0
        public void FromPersistedForm_ValidForm_GetsData()
        {
            var msg = TeamCollectionMessage.FromPersistedForm("2009-06-15T13:45:30.0000000-07:00\tError" + goodParts);

            Assert.That(msg.When.Year, Is.EqualTo(2009));
            Assert.That(msg.MessageType, Is.EqualTo(MessageAndMilestoneType.Error));
            Assert.That(msg.Param1, Is.EqualTo("Fred"));
            Assert.That(msg.Param0, Is.EqualTo("My book"));
            Assert.That(msg.RawEnglishMessageTemplate, Is.EqualTo("A new book {0} arrived from {1}"));
            Assert.That(msg.L10NId, Is.EqualTo("TeamCollection.NewBook"));
        }
Exemple #5
0
        [TestCase("2009-06-15T13:45:30.0000000-07:00\tnonsence", true)] // invalid type
        public void FromPersistedForm_InvalidForm_ReturnsNull(string badForm, bool appendGoodParts)
        {
            var msg = TeamCollectionMessage.FromPersistedForm(badForm + (appendGoodParts ? goodParts : ""));

            Assert.That(msg, Is.Null);
        }