GetCurrentVersion() public méthode

public GetCurrentVersion ( IResource newResource, IResource oldResource, string userName, string reason ) : IVersionInfo
newResource IResource
oldResource IResource
userName string
reason string
Résultat IVersionInfo
        public void VersionStrategy_GetCurrentVersion_OldResource_hasVersion_ExpectExistingVersion()
        {
            //------------Setup for test--------------------------
            var versionStrategy = new VersionStrategy();
            var id = Guid.NewGuid();
            var ver = Guid.NewGuid();
            var oldResource = new Mock<IResource>();
            oldResource.Setup(a => a.VersionInfo).Returns(new VersionInfo(DateTime.Now, "mook", "usr", "12", id, ver));

            //------------Execute Test---------------------------
            var output = versionStrategy.GetCurrentVersion(new Mock<IResource>().Object, oldResource.Object, "bob", "save");


            //------------Assert Results-------------------------
            Assert.AreEqual(output.VersionNumber, "12");
            Assert.AreEqual(output.Reason, "mook");
            Assert.AreEqual(output.User, "usr");
            Assert.AreEqual(output.DateTimeStamp.Date, DateTime.Today);
        }
        public void VersionStrategy_GetCurrentVersion_OldResource_Old_ExpectNewVersion()
        {
            //------------Setup for test--------------------------
            var versionStrategy = new VersionStrategy();

            var oldResource = new Mock<IResource>();


            //------------Execute Test---------------------------
            var output = versionStrategy.GetCurrentVersion(new Mock<IResource>().Object, oldResource.Object, "bob", "save");


            //------------Assert Results-------------------------
            Assert.AreEqual(output.VersionNumber, "1");
            Assert.AreEqual(output.Reason, "save");
            Assert.AreEqual(output.User, "bob");
            Assert.AreEqual(output.DateTimeStamp.Date, DateTime.Today);
        }
        public void VersionStrategy_GetCurrentVersion_OldResourceNull_GetVersion1()
        {
            //------------Setup for test--------------------------
            var versionStrategy = new VersionStrategy();


            //------------Execute Test---------------------------
            var output = versionStrategy.GetCurrentVersion(null, new VersionInfo(DateTime.Now, "bob", "dave", "1", Guid.Empty, Guid.Empty), "bob", "save");


            //------------Assert Results-------------------------
            Assert.AreEqual(output.VersionNumber, "2");
            Assert.AreEqual(output.Reason, "save");
            Assert.AreEqual(output.User, "bob");
            Assert.AreEqual(output.DateTimeStamp.Date, DateTime.Today);
        }