public void GetNotes_Second_WTNUSI_USES_Associated_Triad_USI_to_get_Notes()
        {
            //Arrange
            var response = new ServiceHistoryCollectionDto();
            const string subID = "SUBID";
            const string expectedID = "PROVISIONEDID";

            var passedUsi = string.Empty;

            using (ShimsContext.Create())
            {
                SIMPLTestContext testContext = new SIMPLTestContext();
                var fakeUser = testContext.GetFakeUserDtoObject();
                ShimCurrentUser.AsUserDto = () => fakeUser;
                ShimCurrentUser.GetInstance = () => new ShimCurrentUser
                {
                    UniqueIdGet = () => "mjw425"
                };

                var session = GetShimmedSession();

                var context = new ShimHttpContext();
                ShimHttpContext.CurrentGet = () => context;
                ShimHttpContext.AllInstances.SessionGet = (o) => session;
                ShimRosettianClient.AllInstances.GetServiceHistorySearchServiceHistoryDtoUserDto = (client, criteria, user) =>
                {
                    passedUsi = criteria.SubscriberId;
                    return response;
                };
                var dataSourcerequest = new DataSourceRequest()
                {
                    Aggregates = new List<AggregateDescriptor>(),
                    Filters = new List<IFilterDescriptor>(),
                    Groups = new List<GroupDescriptor>(),
                    Page = 1,
                    PageSize = 0,
                    Sorts = new List<SortDescriptor>()
                };
                var fromDate = DateTime.Now.AddDays(-7).ToString();
                var toDate = DateTime.Now.AddDays(7).ToString();
                var defaultFilterAsJson =
                   "{'NoteTypes':['Triad'],'IsCustomDate':true,'FromDateRange':'" + fromDate + "','ToDateRange':'" + toDate + "','SubscriberId':'" + subID + "','LocationId':'1319028645001', 'ProvisionedId': '"+expectedID+"'}";
                //Act
                var result = NotesControllerForTest.GetNotes(dataSourcerequest, defaultFilterAsJson) as JsonResult;
                //Assert
                Assert.AreEqual(expectedID, passedUsi, string.Format("Did not used provisioned USI: {0}, Actual: {1}", expectedID, passedUsi));//change to expectedid
            }
        }
Exemple #2
0
 /// <summary>
 /// ValidateServiceHistory method - takes ServiceHistoryCollectionDto objects
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actual"></param>
 public static void ValidateServiceHistory(ServiceHistoryCollectionDto expected, ServiceHistoryCollectionDto actual)
 {
     if (expected == null)
     {
         return;
     }
     ValidateCount(expected.Count, actual.Count, TestAttribute.ServiceHistory);
 }