public void ThrowArgumentNullExceptionIfSerializeTourStepsListParameterisNull() { // Arrange TourStepsList tourStepsList = null; // Act and assert Assert.Throws <ArgumentNullException>(() => Services.TourStepsService.SerializetourStepsList(tourStepsList)); }
/// <summary> /// Serializes an instance of a <see cref="TourStepsList"/> into JSON string. /// </summary> /// <param name="tourStepsList">The instance of <see cref="TourStepsList"/> to be deserialized.</param> /// <returns>The serialized JSON string from an instance of a <see cref="TourStepsList"/>.</returns> public static string SerializetourStepsList(TourStepsList tourStepsList) { if (tourStepsList == null) { throw new ArgumentNullException(nameof(tourStepsList), "The list of tour steps cannot be null."); } string tourStepsJson = JsonConvert.SerializeObject(tourStepsList, Formatting.Indented); return(tourStepsJson); }
public void SerializeTourStepsListIfTourStepsListParameterIsEmptyCollection() { // Arrange var emptyTourStepsList = new TourStepsList(); // Act var tourStepsJson = Services.TourStepsService.SerializetourStepsList(emptyTourStepsList); // Assert Assert.NotNull(tourStepsJson); }
public void SerializeListOfTourStepsIntoJsonString() { /* Arrange */ // create list of two tour-steps var tourSteps = new List <TourStepsModel>() { new TourStepsModel() { Target = ".sign-in-section", Content = "When you're signed in, you can run all queries with all request options. We recommend that you sign in with a sample Azure AD account where you are the tenant admin.", DirectionalHint = 10, SpotlightClicks = true, HideCloseButton = true, AutoNext = false, DisableBeacon = true, Advanced = true, Title = "Sign in", ExpectedActionType = "PROFILE_REQUEST_SUCCESS", Query = { SelectedVerb = TourStepsModel.QueryObject.HttpMethods.GET, SelectedVersion = "v1.0", SampleUrl = "https://graph.microsoft.com/v1.0" }, DocsLink = "", Active = true }, new TourStepsModel() { Target = ".query-box", Content = "You can type your Graph queries here. It has an autocomplete feature as well as links to the docs for some queries. Add a '/m' at the end then scroll and choose 'me' from the autocomplete suggestions. Click 'Run query' to run this query", DirectionalHint = 10, SpotlightClicks = true, HideCloseButton = true, Title = "Want to run a Graph API query?", AutoNext = false, DisableBeacon = true, ExpectedActionType = "QUERY_GRAPH_SUCCESS", Query = { SelectedVerb = TourStepsModel.QueryObject.HttpMethods.GET, SelectedVersion = "v1.0", SampleUrl = "https://graph.microsoft.com/v1.0" }, Advanced = true, DocsLink = "", Active = true } }; var tourStepsList = new TourStepsList() { TourSteps = tourSteps }; // Act // Get serialized JSON string of the list of tour steps var newTourStepsJson = Services.TourStepsService.SerializetourStepsList(tourStepsList); // Assert Assert.NotNull(newTourStepsJson); }