ABsoluteMaybe.Tests.Persistence.XmlExperimentCommandsTests.EndExperimentShouldNotOverwriteExistingEndDate C# (CSharp) Méthode

EndExperimentShouldNotOverwriteExistingEndDate() private méthode

private EndExperimentShouldNotOverwriteExistingEndDate ( ) : void
Résultat void
        public void EndExperimentShouldNotOverwriteExistingEndDate()
        {
            //arrange
            const string experimentName = "Troy's Experiment";
            const string alwaysUseOption = "Bar";
            _commands.Reset();
            _commands.GetOrCreateExperiment(experimentName, new[] { "Foo", "Bar" });
            var timestamp1 = new DateTime(2008, 5, 24);
            _commands.UtcNowFactory = () => timestamp1;
            _commands.EndExperiment(experimentName, alwaysUseOption);

            //act
            var timestamp2 = new DateTime(2008, 5, 25);
            _commands.UtcNowFactory = () => timestamp2;
            _commands.EndExperiment(experimentName, alwaysUseOption);

            //assert
            var xml = XDocument.Parse(_commands.SavedXml);
            var exp = xml.Root.Elements("Experiment").Single();

            DateTime.Parse(exp.Attribute("Ended").Value).ShouldEqual(timestamp1);
        }