public void ConvertPushNoticationTableToModel() { // arrange var pushSubscriptionTable = new PushNotificationSubscriptionTable() { Id = 10, AuthSecret = "auth secret", EndPoint = "end point", Key = "key" }; var pushSubscriptionModel = new PushSubscription("end point", "key", "auth secret"); // act var pushSubscription = mapper.Map <PushSubscription>(pushSubscriptionTable); // assert Assert.True(pushSubscription.IsPushSubscriptionEqual(pushSubscriptionModel)); }
public void ConvertPushNotificationDtoToTable() { // arrange var pushNotificationDto = new PushNotificationSubscriptionDto() { AuthSecret = "auth secret", EndPoint = "end point", Key = "key" }; var pushNotificationTable = new PushNotificationSubscriptionTable() { Id = 10, AuthSecret = "auth secret", EndPoint = "end point", Key = "key" }; // act var pushNotification = mapper.Map <PushNotificationSubscriptionTable>(pushNotificationDto); // assert Assert.True(pushNotificationTable.IsPushNontificationTableEqual(pushNotification)); }
public static bool IsPushNontificationTableEqual( this PushNotificationSubscriptionTable pushNotificationTable1, PushNotificationSubscriptionTable pushNotificationTable2) { if (pushNotificationTable1.Id == pushNotificationTable2.Id) { throw new Exception("PushNotificationSubscriptionTable 'Id' should be 0."); } if (pushNotificationTable1.AuthSecret != pushNotificationTable2.AuthSecret) { throw new Exception("PushNotificationSubscriptionTable 'AuthSecret' are not Equal"); } if (pushNotificationTable1.EndPoint != pushNotificationTable2.EndPoint) { throw new Exception("PushNotificationSubscriptionTable 'EndPoint' are not Equal"); } if (pushNotificationTable1.Key != pushNotificationTable2.Key) { throw new Exception("PushNotificationSubscriptionTable 'Key' are not Equal"); } return(true); }