public void WhenApplicationWithSameNameExistsReturnsDuplicateResult()
        {
            var state = new VersionedApplicationState("test", "description");
            var stateStoreSpy = new VersionApplicationStateStoreMock();
            stateStoreSpy.SetupApplicationStateToReturn(state);

            var classUnderTest = new ApplicationVersionKeeper(stateStoreSpy);

            var existingApplication = classUnderTest.AddVersionedApplication("test", "other description");
            Assert.That(existingApplication, Is.TypeOf<ExistingVersionedApplication>());
        }
        private static VersionedApplication ConfigureVersionKeeperWithApplicationState(VersionedApplicationState applicationState = null)
        {
            if (applicationState == null)
                applicationState = new VersionedApplicationState("name", "desc");

            var versionApplicationStateStoreMock = new VersionApplicationStateStoreMock();
            versionApplicationStateStoreMock.SetupApplicationStateToReturn(applicationState);
            var classUnderTest = new ApplicationVersionKeeper(versionApplicationStateStoreMock);
            VersionedApplication application = classUnderTest.AddVersionedApplication("name", "desc");
            return application;
        }
        public void CanRetrieveAnApplicationWhenItIsTheStateStore()
        {
            const string applicationDescription = "description";
            const string applicationName = "test";

            var stateStore = new VersionApplicationStateStoreMock();
            stateStore.SetupApplicationStateToReturn(new VersionedApplicationState(applicationName, applicationDescription));

            var classUnderTest = new ApplicationVersionKeeper(stateStore);
            VersionedApplication application = classUnderTest.GetVersionedApplication(applicationName);

            Assert.That(application, Is.Not.Null);
            Assert.That(application.Name, Is.EqualTo(applicationName));
            Assert.That(application.Description, Is.EqualTo(applicationDescription));

            stateStore.AssertThisApplicationNameWasRequested(applicationName);
        }