Esempio n. 1
0
        public void UpdateMappings_ShouldUpdateWireMockMappings()
        {
            var mappingInfoViewModels = MappingInfoViewModelTestUtils.SomeMappings();

            MockServer.UpdateMappings(mappingInfoViewModels);

            WireMockMappingsShouldBeConfiguredWith(mappingInfoViewModels);
        }
Esempio n. 2
0
        public void WhenMainWindowsViewModelIsInstantiated_Mappings_ShouldReturnTheMappingReturnByMappingsProvider()
        {
            var expectedMappings = MappingInfoViewModelTestUtils.SomeMappings();

            A.CallTo(() => _mappingsProvider.LoadMappings()).Returns(ToPersistableMappings(expectedMappings));

            _mainWindowViewModel = new MainWindowViewModel(_mockServer, _mappingsProvider);

            _mainWindowViewModel.Mappings.Should().BeEquivalentTo(expectedMappings);
        }
Esempio n. 3
0
        public void Constructor_ShouldCallMockServerUpdateMappingsWithLoadedMappings()
        {
            var expectedMappings = MappingInfoViewModelTestUtils.SomeMappings();

            A.CallTo(() => _mappingsProvider.LoadMappings()).Returns(ToPersistableMappings(expectedMappings));

            _mainWindowViewModel = new MainWindowViewModel(_mockServer, _mappingsProvider);

            A.CallTo(() => _mockServer.UpdateMappings(A <IEnumerable <MappingInfoViewModel> > .That.Matches(map => AreEqual(map, expectedMappings)))).MustHaveHappenedOnceExactly();
        }
Esempio n. 4
0
        public void ApplyCommand_ShouldCallMockServerUpdateMappingsAndShouldSaveMappings()
        {
            var expectedMappings = MappingInfoViewModelTestUtils.SomeMappings();

            A.CallTo(() => _mappingsProvider.LoadMappings()).Returns(ToPersistableMappings(expectedMappings));
            _mainWindowViewModel = new MainWindowViewModel(_mockServer, _mappingsProvider);
            Fake.ClearRecordedCalls(_mockServer);

            ExecuteApplyCommand();

            A.CallTo(() => _mockServer.UpdateMappings(_mainWindowViewModel.Mappings)).MustHaveHappenedOnceExactly()
            .Then(A.CallTo(() => _mappingsProvider.SaveMappings(ShouldMatchInfoMappingsViewModel(_mainWindowViewModel.Mappings))).MustHaveHappenedOnceExactly());
        }